Facing some Issues on Two Parts Custom Post Type Taxonomy Names
The slug refers to the url eg http://wwww.sitename.com// so you want it to have no spaces and be in lower case eg special-offers
The slug refers to the url eg http://wwww.sitename.com// so you want it to have no spaces and be in lower case eg special-offers
You can achieve this using the save_post hook. save_post is an action triggered whenever a post or page is created or updated, which could be from an import, post/page edit form, xmlrpc, or post by email. add_action( ‘save_post’, ‘wpse254017_set_post_title’, 10, 2 ); function wpse254017_set_post_title ( $post_id, $post ){ //This temporarily removes action to prevent infinite … Read more
After @Howdy_McGee confirmed the code works I had to look elsewhere. I noticed I had a duplicate post with the same title (that WASN’T categorized as “Gated”) that was always displaying. So I didn’t notice when the Gated one was disappearing. >.<
You need to set up query for pagination, look at this example : $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $args = array( ‘post__in’ => $ids, ‘post_type’ => ‘product’, ‘paged’ => $paged, ‘posts_per_page’ => 15); query_posts($args);
All you need is to store the post IDs of the products together with the order (easiest is through post_meta). Then you can run a WP_query to fetch all the products. The example below is a system that grants users access to a custom post type and charge credits, and gives options to send e-mail … Read more
What’s the most efficient way to get two queries based on an if statement?
You could use get_the_title() to store the title inside a variable.. the_title() would actually print the title ..
You can first get posts from your featured category and check if it has any posts or not. If yes, you will show them. If not, you will make another query that will get 3 posts from random categories (as you described) and show them. $events_args = array( // include the code in your question … Read more
What you’re meant to be doing is echoing the $meta_value, not assigning it to a variable. Also don’t forget to escape the value 🙂 <!– Claim Your Bonus Button –> <p class=”readmore”> <a class=”more-link claim-bonus” href=”https://wordpress.stackexchange.com/questions/254370/<?php echo( esc_url( get_post_meta( $postID->ID,”tracking_url’, true ) ) ); ?>” rel=”nofollow” title=””>Claim Bonus » </a> </p>
I figured it out. I needed to add ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’, to $related_posts = get_related_posts( ‘juryyear’, array( ‘posts_per_page’ => 99,) );