I have to show all the posts from custom type post on my product page. So I am using the Custom Post Type plugin. Now I want to display all the posts in the product page like it was a blog page of WordPress. I am using the code below to display the posts in the product page..
add_filter( 'pre_get_posts', 'my_get_posts' );
function my_get_posts( $query ) {
if ( is_page('product') && $query->is_main_query() )
$query->set( 'post_type', array('products' ) );
return $query;
}
But I can’t get the page. If there is some other way to display all the posts in the page, then please help me out.
It should be easier to make a specific template for your page, and use
get_posts
function.To create a specific template for a page :
http://codex.wordpress.org/Pages#What_Template_is_Used_to_Display_a_Particular_Page.3F
How to use get_posts :
http://codex.wordpress.org/Template_Tags/get_posts
Add this code where you want all post’s change the ID of category and number of post’s…