CMB2 metabox create select with list of post from CPT
Your WP_Query has ‘post_per_page’ instead of ‘posts_per_page’. (missing an “s” on posts)
Your WP_Query has ‘post_per_page’ instead of ‘posts_per_page’. (missing an “s” on posts)
You better look at the second answer at the post you gave link. Use content-{post-type}.php to name all the template for each post type (If you want to know how you have to break down the template to pieces of content-{post-type}.php, then please have look at the Twenty Sixteen theme’s template-parts directory and analyze it’s … Read more
Thanks to WebElaine for pointing out the obvious solution! Just created a post in the custom post type and gave it a unique template, thus achieving the desired url.
From the plugin code I can see that it uses query_posts() to set up a new context for your template if you’re using display=”blah.php”. So you should just need to add the loop around your template: <?php /** * Template Name: Gallery */ while ( have_posts() ): the_post(); // <– Important bit if( have_rows( ‘card’ … Read more
All websites in the multisite are independent and have own database tables, and they can have own plugins and own post types. Post types need to be registered on each site in the multisite, and posts have to be in the database tables for each site. There is no content on the network level that … Read more
You could get your get_publications functions to return a JSON object with all sorts of information you need. e.g function get_publications() { // Your query here. $data = [ ‘html’ => $your_html, ‘found_posts’ => $query->found_posts, ‘current_post’ => $query->current_post, ‘current_page’ => $page, etc… ]; echo json_encode($data); } And then parse that data with your javascript.
$args = array( ‘post_type’ => ‘Portfolio’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘portfolio_categories’, ‘terms’ => $slug, ‘field’ => ‘slug’, ) ), ‘orderby’ => ‘ID’, ‘order’ => ‘DESC’, ‘posts_per_page’ => -1 );
I would start by reorganizing your $args code to make more sense. $now = date(‘d-m-Y H:i:s’); $cat=”featured”; $args = $cat_args = array( ‘post_type’ => ‘events’, ‘posts_per_page’ => 4, ‘meta_key’ => ‘start_date’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’, ‘meta_query’ => array( ‘relation’ => ‘OR’, array( ‘key’ => ‘start_date’, ‘value’ => date(‘Ymd’, strtotime(‘now’)), ‘type’ => ‘numeric’, ‘compare’ … Read more
I’m not sure what you mean about sub-taxonomies. Are you referring to the actual term? If so you could use the following to template it: taxonomy-$taxonomy-$term.php An example of this would be if I had a taxonomy called genres and a term called horror, I could then template this as: taxonomy-genres-horror.php Refer to the template … Read more
wp_count_terms function counts terms in a given taxonomy (e.g. total number of categories, total number of tags). To get what you want, get the terms for the post and just count them count( wp_get_post_terms( $post_id, $taxonomy, $args ) );. Or, assuming that in real life you might need those terms later: $terms = wp_get_post_terms( $post_id, … Read more