Prevent 404 of Author pages without posts

Why should you get redirected to the 404 page if you display an author archive without posts? This isn’t the default behavior of WordPress. For example, if you go to the following URL: http://example.com/{permalink_base}/author/{author_name} WordPress calls the author.php template inside your theme folder. There you have a loop which will return all posts of the … Read more

Multiple Post Thumbnails Plugin – Need help with code

Here is a complete example using the code you provided: For your functions.php file: <?php // Add secondary thumbnail (featured image) in posts */ if (class_exists(‘MultiPostThumbnails’)) { new MultiPostThumbnails(array ( ‘label’ => ‘Secondary Image’, ‘id’ => ‘secondary-image’, ‘post_type’ => ‘post’ ) ); new MultiPostThumbnails(array( ‘label’ => ‘Quaternary Image’, ‘id’ => ‘quaternary-image’, ) ); new MultiPostThumbnails(array( … Read more

One Custom Post Type two different Templates

Yes it is possible. You’ll have to write a custom rewrite rule for making the domain.com/cpt/metaboxes url to be accessible. Lets say your cpt is ‘movie’, its single will be accessible as domain.com/movie/slug. Create a new page named ‘Metaboxes’ (slug should be ‘metaboxes’). Add the following code to functions.php. <?php add_action(‘init’, ‘add_my_rule’); function add_my_rule() { … Read more

Shortcode in pages or tempate files for custom post type

Lucas Wynne linked some good plugins for such functionalities (I have used Addthis multiple times), however if you’re looking for a plugin-free solution, i’d more likely filter the content in my functions.php file instead of using a shortcode : some pseudo-code function add_content( $content ){ $content .= “<a href=\”facebook\”>FACEBOOK</a>”; return $content; } For more info … Read more