I have a custom post type called press
.
What I want to achieve is generate a list of the titles (with it's corresponding link to it) of all press
custom post types.
I tried with this code with no luck, any ideas?
<?php function all_posts_custom_posts( $query ) {
$post_type = $query->query_vars['post_type'];
if ( 'press' == $post_type ){
$query->query_vars['posts_per_page'] = -1;
return;
}
}
add_action('pre_get_posts', 'all_posts_custom_posts',1); ?>
And also highlight the current post from the list by adding a class
to it.