Loop through custom posts by taxonomy and display the titles in a list, it is repeating 8 times

You’ve hard-coded the term into the second query. Of course you are seeing the same thing every time: $terms = get_terms( ‘model’, array( ‘orderby’ => ‘count’, ‘hide_empty’ => 0 ) ); if (!is_wp_error($terms)) { foreach( $terms as $term ) { // Define the query $args = array( ‘post_type’ => ‘peterbilt’, ‘tax_query’ => array( array( ‘taxonomy’ … Read more

Display custom post using ID

EDIT: deleted incorrect information I see what you are missing now. Without knowing the specifics, I tried to point you in the right direction with this: $my_query = new WP_Query(‘post_type=sliders&p=411’); if( $my_query->have_posts() ) { while ( $my_query->have_posts() ) : $my_query->the_post(); // Get the specific meta data for the current post $saved_slider_meta = get_post_meta( get_the_ID(), ‘slider_meta_key’ … Read more

How to set up Custom Post Type archive page as Front page

I was able to solve the issue on https://wordpress.stackexchange.com/users/4771/milo suggestion. For this, I created a drop down menu in theme customizer from where I can select a dummy static page to act as Portfolio Page. I’ve used following code for drop down menu: add_action( ‘customize_register’, ‘th_customize_register’ ); function th_customize_register($wp_customize) { // Add: Drop Down Pages … Read more

Display post from a date range from custom field

The magic parameter ist described at WP_Query under: Custom Field Parameters You need to add a meta_query array to your $args where you define your range. In your case the code could look like this: $range = array( ‘2015-05-01’, ‘2015-05-31’, ); $args = array( ‘post_type’ => ‘score_post_type’, ‘posts_per_page’ => 5, ‘meta_key’ => ‘score_time’, ‘orderby’ => … Read more

Custom User role not working with custom post type

I thought I would try to clarify my comments: You only get a few things out of setting your capability_types the way you have above, which it is explained in Note 2 of capabilities. Here is what I see looking at $GLOBALS[‘wp_post_types’][‘adoptions’]->cap: stdClass Object( [edit_post] => edit_adoption [read_post] => read_adoption [delete_post] => delete_adoption [edit_posts] => … Read more

How does the ‘the_post_navigation()’ work for CPT’s?

‘the_post_navigation’. It seems to work for Custom Post Types (CPTs) but I cannot figure out how it does this. the_post_navigation() uses get_the_post_navigation() which uses get_previous_post_link() and get_next_post_link() which both uses get_adjacent_post_link() which uses get_adjacent_post() to get the next and previous post from the same post type. If we look at the source code for get_adjacent_post(), … Read more