Functions.php: If its single?

add_filter(‘wpseo_set_title’, ‘wpseo_set_title_callback’); function wpseo_set_title_callback($input) { if (is_single()) { return ‘Now Single’; } // return default return $input; } Or example from wpSEO Hilfecenter: add_action(‘init’, ‘wpseo_set_title’); function wpseo_set_title() { add_filter( ‘wpseo_set_title’, ‘wpseo_set_title_callback’ ); } function wpseo_set_title_callback($input) { if (is_single()) { return ‘Now Single’; } // Else return default: return ‘Das Buch “‘. $input . ‘” probelesen.’; … Read more

How do I create a single.php for a specific category?

I think this does what you want: function ag_templates( $template=”” ){ global $post; $meta = get_post_meta( $post->ID, ‘_category_permalink’, true ); if( 53 == $meta ){ $template = locate_template( array( “single-category-53.php”, $template ), false ); } return $template; } add_filter( ‘single_template’, ‘ag_templates’ );

Single.php Active Category Class

As vancoder notes, a post can have multiple categories and the following code highlights each category, as well as the current month for the post. Add to your theme’s functions.php. // Generate active class for categories when viewing single posts // Props to Sam Nabi http://samnabi.com/blog/highlight-the-current-category-for-single-posts-in-wordpress function singlePostActiveCat ($CatText) { global $post; if (is_singular()) { … Read more

Create single.php for specific category by category id

You can use this function to add category specific single template pages on your website. This goes in functions.php You can define as many single templates as you want. function wpse_category_single_template( $single_template ) { global $post; $all_cats = get_the_category(); if ( $all_cats[0]->cat_ID == ‘1’ ) { if ( file_exists(get_template_directory() . “/single-cat1.php”) ) return get_template_directory() . … Read more

How to have different content in the loop and single

you can add additional information to your posts through using post meta: http://wp.tutsplus.com/tutorials/plugins/how-to-create-custom-wordpress-writemeta-boxes/ If you want to check if WordPress is going to display just a single post/single page or more, you could use something like this before your loop: $single_page = false; if(is_single() || is_page()) $single_page = true; And then in your loop you … Read more

Using previous_post_link and next_post_link to wrap around post sequence

Add following custom functions in functions.php file and instead of calling previous_post_link and next_post_link functions call custom_next_post_link and custom_previous_post_link custom functions respectively. function custom_adjacent_post_link( $format, $link, $in_same_cat = false, $excluded_categories=””, $previous = true ) { if ( $previous && is_attachment() ) $post = get_post( get_post()->post_parent ); else $post = get_adjacent_post( $in_same_cat, $excluded_categories, $previous ); if … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)