No-Title Sticky Post-Format Posts?!
in Tips
as add_theme_support, post-formats, post_class, sticky posts, WordPress
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' ) )
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
in Tips
as apply_filters, how-to, WordPress, wp_title
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
in Tips
as add_action, how-to, is_readable, plugin_dir_path, plugin_dir_url, WordPress, wp_enqueue_scripts, wp_enqueue_styles
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
in Tips
as beta, how-to, WordPress
The basics, as a general guideline, on how to start using the latest WordPress beta version.
Dynamic Copyright Revisited
in Tips
as apply_filters, bns_dynamic_copyright, dynamic_copyright, WordPress
An updated version of the dynamic copyright function found in BuyNowShop.com themes by Cais.
WordPress Child-Themes
as child-theme, how-to
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
as how-to, installation, reset, WordPress
How to reset your WordPress test site in three easy steps.
WordPress Christmas
in Tips
as plugin, themes, WordPress
Merry Christmas 2010!




Remove Comment Form Website Section
in Functions, Tips
as add_filter, comment_form, how-to, WordPress
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:
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:
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.