Featured post and custom post types
-
First, I’d just like to kick this off by saying, when it comes to php, I’m pretty much a noob. I’ve been using the Pods framework to extend the functionality of the theme and thus far I’ve achieved the results I’ve been looking for. It’s taken a lot of time and countless google search to get custom post types to display both on the front page, the feed, and the archive pages. I’ve done this mainly by adding this code to my functions.php:
add_filter( 'pre_get_posts', 'my_get_posts' ); function my_get_posts( $query ) { if( is_admin() ) { return; } if ( ( is_home() && $query->is_main_query() ) || is_archive() || is_feed ()) $query->set( 'post_type', array( 'post', 'blog', 'bio', 'story', 'ref' ) ); return $query; }The only problem, the featured posts capability does not seem to recognize the custom post types and despite my numerous attempts, I’ve been unable to determine how to get it to display them.
The topic ‘Featured post and custom post types’ is closed to new replies.
