First page of the Tips 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.

No-Title Sticky Post-Format Posts?!

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

Say what?! Seriously?

Yes, seriously. Although this sort of thing is not too likely to exist in the wild here are a few tips and idea to keep in mind when developing a theme.

Let’s start from the end with ‘post-format’ posts and work our way back to the beginning. It wasn’t all that long ago WordPress introduced default post-formats that could be easily added to themes. Here’s a one-liner to put in your functions.php file that does it all, well it’s a good example from the codex showing two post-formats:

add_theme_support( 'post-formats', array( 'aside', 'gallery' ) )
To read more about Post Formats, click hereTo hide the Post Formats click here.
There are nine (9) default ‘post-formats’ as of this writing; there may be more added in the future but these work well. The number of ways end-users might use them is not much less than the ideas they can imagine.

Following is the complete “supported” list. You can visit the codex for what some might consider their recommended usages.

  • aside
  • gallery
  • link
  • image
  • quote
  • status
  • video
  • audio
  • chat

Post-formats have been around since WordPress Version 3.1, if you are not familiar with them yet you should go back and read more about them.

Our next step back is to Sticky Posts introduced back in version 2.7. If you are not familiar with sticky posts then definitely take a few moments to read the articles linked to … I can wait.

So far, so good … right? Good!

Now let’s get to the beginning of the post title: No-Title; and, yes, this is something that should be addressed when developing a theme. The Shadow knows … otherwise one may never know the imagination of the end-user, or if their personal taste demands one (or many) posts are published without a title. Generally speaking, each of these items are handled well enough on their own but what happens when you combine them? If you have thoroughly tested your theme then most any combination of these elements should have been easily and clearly addressed; most of which can be done with simple CSS, too.

The key CSS elements to address for these items are the following:

  • .format-aside
  • .format-gallery
  • .format-< post-format > – substitute < post-format > with the appropriate term
  • .sticky

There may, or may not, be a theme CSS element used for a post without a title but that is well beyond the scope of this post; just remember to test each ‘post-format’ with and without a title.

Now last, but not least, the simple CSS element to remember for the final testing: ‘.format-< post-format >.sticky’ … again substituting the < post-format > for *all* of the ‘post-formats’ used in the theme. Note there is no space between, for example, .format-aside and .sticky the element would be: .format-aside.sticky … these elements are automatically generated by WordPress if the theme uses the `post_class` function correctly.

Granted this was a bit long written but hopefully helpful. It’s just something I found that required a lot more to properly address than what I first suspected as I was updating my theme Desk Mess Mirrored to version 2.0.

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 [...]

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.

Dynamic Copyright Revisited

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

An updated version of the dynamic copyright function found in BuyNowShop.com themes by Cais.

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.

WordPress Christmas

Posted by The Doctor on Dec 22, 2010 with 1 Comment | Short Link
in Tips
as , ,

Merry Christmas 2010!

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.