First page of the how-to archive.

Remove Comment Form Website Section

Posted by The Doctor on Jan 17, 2012 with No Comments | Short Link
in Functions, Tips
as , , ,

From time to time an interesting Five-Minute-FixTM comes along that sparks a great reason to add another WordPress Tips post. The idea for this tip started with this comment at BuyNowShop.com:

… how to remove the website section when leaving a reply/comment …

The solution may be obvious to some and can be readily derived from the information found on the WordPress codex page for the `comment_form` function, but if you are new to WordPress and/or not familiar with writing a function to use with `add_filter`, here is a very simple and working snippet to use in your theme:

To see the tip click here.To hide the tip click here.
function wpfa_remove_comment_website_section(){
    $commenter = wp_get_current_commenter();
    $req = get_option( 'require_name_email' );
    $aria_req = ( $req ? " aria-required='true'" : '' );
    $fields =  array(
        'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) .
                    '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>',
        'email'  => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) .
                    '<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>',
        'url'    => '' /** removes website section */,
    );
    return $fields;
}
add_filter( 'comment_form_default_fields', 'wpfa_remove_comment_website_section' );

Ideally, this will be placed in the ‘functions.php’ file of your theme, but better yet this should be included in the Child-Theme you created of the theme you want to modify.

Filtering WP Title

Posted by The Doctor on Nov 30, 2011 with No Comments | Short Link
in Tips
as , , ,

A recent recommendation, starting with WordPress 3.3, from the WordPress Theme Review Team reads:

Themes are REQUIRED to use wp_title filter to filter wp_title() (RECOMMENDED), or pass argument to wp_title() (OPTIONALLY), in order to modify document title content

This has been discussed, worked through, and for the most part sorted out … but there doesn’t appear to be any sort of example code to work from. This presented an opportunity to have a look around the WordPress codex and the source code for some ideas how to filter the `wp_title` function.

Essentially, the idea behind the code (below) is to take a basic function call of `wp_title` add some relevant text (a la default themes: Twenty Ten / Twenty Eleven) then filter it back into the function; and finally to echo this to the HTML <title> tag.

To see the WPFA WP Title code click here.To hide the WPFA WP Title code click here.
<?php
/**
* WPFA WP Title
*
* Utilizes the `wp_title` filter to add text to the default output
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/wp_title
*
* @package WPFA_WP_Title
* @since 0.1
* @link https://gist.github.com/1410493
*/
if ( ! function_exists( 'wpfa_wp_title' ) ) {
    function wpfa_wp_title() {
            global $page, $paged;
            // Default title
            $title_text = wp_title( '|', false, 'right' ) . get_bloginfo( 'name' );

            // Add the blog description (tagline) for the home/front page.
            $site_tagline = get_bloginfo( 'description', 'display' );
            if ( $site_tagline && ( is_home() || is_front_page() ) )
                $title_text .= " | $site_tagline";

            // Add a page number if necessary:
            if ( $paged >= 2 || $page >= 2 )
                $title_text .= ' | ' . sprintf( __( 'Page %s', 'wpfa-wp-title-textdomain' ), max( $paged, $page ) );

            // Use `apply_filters` on `wp_title` and echo
            $wpfa_wp_title = apply_filters( 'wp_title', $title_text );
            echo $wpfa_wp_title;
    }
}
// End WPFA WP Title
?>

Hopefully this will be useful, or maybe it will not … but it will be found in the next release of Desk Mess Mirrored as that is the theme where I first wrote and tested it with.

Enjoy!

To see the note click here.To hide the note click here.
PS: Note the github:gist link in the code sample … feel free to download it from there, as well as copying it from here. The Doctor.

Enqueue Plugin Custom Stylesheet

Posted by The Doctor on Nov 15, 2011 with No Comments | Short Link
in Tips
as , , , , , , ,

Now that is a bit of a handful to grab onto … but the code and concept is relatively straight forward and easy to implement. As I was recently updating some of my plugins in preparation for WordPress 3.3 I decided to better implement the style elements being used in these plugins. The current best-practice [...]

Start Using WordPress Beta

Posted by The Doctor on Oct 12, 2011 with 2 Comments | Short Link
in Tips
as , ,

The basics, as a general guideline, on how to start using the latest WordPress beta version.

Do Not Display Comments HTML Tags

Posted by The Doctor on Aug 7, 2011 with 12 Comments | Short Link
in Functions
as , ,

A standard function found in many themes is the comment_form. This is a core function of WordPress that produces a standard comment form generally consisting of text fields for the name and email address and a textarea for the actual comment. You will also find there are some standard text outputs produced by this function [...]

WordPress Child-Themes

Posted by The Doctor on Apr 9, 2011 with 3 Comments | Short Link
Last modified by The Doctor on April 2, 2011
in Tips
as ,

Let’s start with a definition for a Child-Theme: A WordPress child theme is a theme that inherits the functionality of another theme, called the parent theme, and allows you to modify, or add to, the functionality of that parent theme. the WordPress Codex Child-Themes are also: … the recommended way of making modifications to a [...]

Reset Your WordPress Test Site

Posted by The Doctor on Jan 23, 2011 with 5 Comments | Short Link
Last modified by The Doctor on March 22, 2011
in Tips
as , , ,

How to reset your WordPress test site in three easy steps.

Extend the WordPress Menu

Posted by The Doctor on Oct 7, 2010 with 17 Comments | Short Link
Last modified by The Doctor on October 12, 2010
in Tips
as , , , , , , ,

Expand the wp_nav_menu() function by adding menu items to the output with the add_filter() function.

Upgrade wp_list_categories() to wp_nav_menu()

Posted by The Doctor on Jul 20, 2010 with 6 Comments | Short Link
in Functions
as , , ,

In this third installment in the upgrade to wp_nav_menu() series of posts, I will be dealing with moving from wp_list_categories() to wp_nav_menu(). Let’s start with the same basic outline and list the default options for each function. We will start with wp_nav_menu() 1 first: We follow with wp_list_categories() 2, 3 which is often wrapped in [...]

Upgrade wp_list_pages() to wp_nav_menu()

Posted by The Doctor on Jul 16, 2010 with 1 Comment | Short Link
in Functions
as , , ,

A few options to address and with possibly a minor edit to the theme, you can upgrade wp_list_pages() easily to wp_nav_menu() in your theme.