WooCommerce – How to show specific category first-rest of products-specific category last
WooCommerce – How to show specific category first-rest of products-specific category last
WooCommerce – How to show specific category first-rest of products-specific category last
previous_post_link( ‘<div class=”text-center video-text-btn”> %link </div> ‘, ‘pre’, $in_same_term = true, $excluded_terms=”Standard-post-format-name”, $taxonomy = ‘post_format’ );
Based on data from your Gist, the following pre_get_posts condition should work to limit your posts per page. add_action( ‘pre_get_posts’, ‘my_set_category_posts_per_page’ ); function my_set_category_posts_per_page() { global $wp_query; if ( ‘category_sticky_post’ === $wp_query->query_vars[‘meta_key’] ) { $wp_query->set( ‘posts_per_page’, 8 ); } }
Convert your string of IDs into a proper array: $exclude_ids = get_field( ‘exclude_pages’ ); $exclude_array = explode( “,”, $exclude_ids ); Then pass $exclude_array as the value for post__not_in.
The comment from @czerspalace put me on the right track to doing what I needed. Since the first few terms start with numbers, this is how I implemented my solution: // get results from $wpdb in object called $links $glossary_ltr = “999”; foreach( $links as $link ) { $kw_ltr = substr( $link->keyword, 0, 1 ); … Read more
Your issue is the post_parent parameter, if this is set to 0 or a falsey value like null your query will return all top level posts. So you just have to make sure $rental->post->ID has a value, or use a different approach like the get_the_ID() function. Can’t really tell you more than that as you … Read more
You should modify this fragment: // Define the query $args = array( ‘post_type’ => ‘fiction’, ‘booktype’ => $term->slug, ‘orderby’ => ‘name’, ‘order’ => ‘ASC’ );
How can one split a loop via WP_Query into two columns without having to work with two loops These would be possible with if conditional. and it is possible that for example in the left side those posts of category “A and B” and in the right side those posts of category “C and D … Read more
How to print out menu names in the foreach loop?
Updated answer: The default behavior of WP is exactly what you want. The problem is that you are using get_posts() which completely ignores the sticky post behavior by forcing ignore_sticky_posts = true (check the source). So you need only one query, just use WP_Query(): $postsList = new WP_Query([ ‘post_type’ => ‘post’, ‘posts_per_page’ => $default_posts_per_page, ‘paged’ … Read more