Custom post_type search pages

How are you restricting the search to your custom post type? If you are doing it by passing an additional argument, i.e. &type=myCustomPostType, you could use a conditional test, like: if(isset($_GET[‘type’] && $_GET[‘type’] == ‘myCustomPostType’)): get_template_part(‘loop’,’youtube’); else: get_template_part(loop); endif;

Best practice for including plugin output in a template without using shortcode?

<?php // A) // inside your template if ( function_exists( ‘the_attachment_stuff()’ ) ) { // do stuff } // better/faster if ( class_exists( ‘attachment_plugin_class’ ) ) { // do stuff } // B) // inside your template do_action( ‘the_attachment_suff’); // means setting this inside your plugin // this avoids throwing errors or aborting if the … Read more

Showing latest post without 301 redirect

Custom query loops and custom page templates are your friends. Ditch the redirect function and on your home page template do something like this: <?php $args = array( ‘post_status’ => ‘publish’, ‘post_type’ => ‘seller’, ‘posts_per_page’ => 1 ); query_posts( $args ); // the Loop while (have_posts()) : the_post(); the_content( ); endwhile; ?> You can find … Read more