After scouring on the net and bouncing around, I figured out how to fix my problem.
- Install ACF and create your own post types.
-
In Functions.php, add the following codes to default category for that post type.
function add_pastorheart_category_automatically($post_ID) { global $wpdb; if(!wp_is_post_revision($post_ID)) { $pastorheartcat = array (15); wp_set_object_terms( $post_ID, $pastorheartcat, 'category'); } } add_action('publish_pastors-heart', 'add_pastorheart_category_automatically');
-
Also add this function to include the post type in the category.
function namespace_add_custom_types( $query ) { if( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) { $query->set( 'post_type', array( 'post', 'nav_menu_item', 'pastors-heart' )); return $query; } } add_filter( 'pre_get_posts', 'namespace_add_custom_types' );
-
For default thumbnail image, I put this code in the content-excerpt.php. Instead of checking for post types, I check for category.
It might not be the most elegant way of doing it. But it works for me.