How I can made a custom post type to page templates?

You need to add: ‘supports’ => array(‘title’, ‘editor’,’page-attributes’,’thumbnail’) add this to your array after ‘singular name’ => ‘pictures’. The thumbnail adds the featured image option to your post type. You can access the post type archive: yoursite/archive-pictures, this will use your themes archive.php file if it exists. Or you can create a custom post type … Read more

Exclude latest post from WP_Query taxonomy term loop

wp_query has the offset parameter which you can use to skip posts, e.g. $args = array( ‘post_type’ => ‘video’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘tax-video’, ‘field’ => ‘slug’, ‘terms’ => ‘t-o-t-w’, ), ), ‘posts_per_page’ => ‘8’, ‘offset’ => 1, // excludes the first post in the query ); you may just be over thinking … Read more

Custom Post Type: Show Similar Posts

As I have stated, you need to use the current post’s ID and then return the desired meta value for the given key. This must then be passed to a meta_query. Just a tip, instead of using the unreliable $post global, use the query object saved in $wp_the_query, this will be reliable in 99.99% of … Read more

Add post type pages with plugin

You can’t without hooking a filter to recognise the files in your plugin BUT you can hook into the template_include filter and register your own file e.g. add_filter(‘template_include’, ‘my_function_name’); function my_function_name( $template ) { if( is_post_type_archive( ‘post_type’ ) ){ $template = dirname( __FILE__ ) . ‘/templates/archive-post_type.php’; } if( is_singular( ‘post_type’ ) ){ $template = dirname( … Read more

CPT defaults to single.php?

Yes, they will. You will find the WordPress template heirachy useful, particularly this graphic: This shows how the templating system works – in particular, how WordPress will select the most specific template it can find, with fallbacks to the least specific (eventually, to index.php). In your case, you’ll see in there that single-$posttype.php falls back … Read more