Strange custom post type issue

I suggest you to debug first that whether the loop is carrying all posts or not. You may use print_r() and die combination. If it carries all posts fine then you may move to further steps of debugging. Add pagination code. Because, if your loop do have all the posts with it then probably due … Read more

Creating a “glossary” of WordPress posts of a specific post type

Declare a $previous_letter variable, and at the end of the foreach give it the value of the current $glossary_letter. Before of show the $glossary_letter make an if condition. If $glossary_letter is different to the $previous_letter then show it. $previous_letter = null; foreach ( $postslist as $post ) : setup_postdata( $post ); $glossary_title = get_post_custom_values($key = … Read more

Apply template by path/slug related to custom post type?

You can’t set a project as a base of permalink because you would have to enter rewrite rules for each one. What you can do is create a custom taxonomy related-resources: function wpse_287202_related_resources_taxonomy() { $labels = array( … ); $args = array( ‘labels’ => $labels, ‘hierarchical’ => true, ‘public’ => true, ‘show_ui’ => true, ‘show_admin_column’ … Read more

Custom post type and custom taxonomy 404 on page 2

So after many trials and errors, I found I had to create a specific rewrite rule to go into my functions.php, one that handles post type ‘videos‘ and the category (taxonomy) ‘videos_category‘: add_filter(‘init’, function() { add_rewrite_rule( ‘^videos/([^/]*)/([^/]*)/(\d*)?’, ‘index.php?videos_category=$matches[1]&p=$matches[2]&paged=$matches[3]’, ‘top’ ); }); I also found this plugin to be really helpful for viewing my rewrite rules: … Read more