Pagination is not working properly in Product Category/Tag pages
Pagination is not working properly in Product Category/Tag pages
Pagination is not working properly in Product Category/Tag pages
How to use wp_query to post count by search term > group post count by date > convert to json. (ex. result 12-21-2020 – 343)
Terms generally should have a count parameter that you can use. I’m not sure if this is accurate across multiple post types though. This may not be the fastest solution but one option could be the additional parameters for WP_Query to both reduce the number of queries and the returned values. 10up has a good … Read more
As per comment trying to do this in one action will probably cause unholy pagination issues. It might be easier to limit main query to normal posts, query posts with formats separately (depending on what you have in normal posts by date) and mix two sets together on display.
I’m not aware of any WordPress functions that do this, so you can try to play with this kind of query (untested): function get_custom_user_comments_count( $uid ){ global $wpdb; $sql = “SELECT COUNT(*) as total FROM {$wpdb->comments} as c JOIN {$wpdb->posts} as p ON p.ID = c.comment_post_ID WHERE c.comment_approved = ‘1’ AND p.post_status=”publish” AND … Read more
The one persistent numerical thing about post is ID, however it is sequential for all posts, so you will have gaps if using it. It would be easiest to assign a number and store it in custom field on post creation. Probably take it from an option and increment it there, so that your numbering … Read more
The _n() function will sort out single from plural. How to use it is in the codex. EDIT: Apologies. My first go at an answer wasn’t quite enough to get you there. The trouble with using wp_list_categories() in this context is that it prints out pre-formatted HTML and you don’t end up with any value … Read more
You can fetch the record using bellow query $posts= get_posts(array( ‘numberposts’ => -1, ‘post_status’ => ‘publish’, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘date_query’ => array( ‘column’ => ‘post_date’, ‘after’ => ‘-7 days’ // -7 Means last 7 days ) )); echo count($posts); If you want to get last 6 month the use -6 Months
Depending on your needs, WP Query may not work for this since it won’t include posts that have been deleted after the trash has been emptied. This should work (but hasn’t been tested): function wpse_custom_post_type_counter() { $number = get_option( ‘wpse_custom_counter’ ) ? absint( get_option( ‘wpse_custom_counter’ ) ): 0; $number++; update_option( ‘wpse_custom_counter’, $number ); } add_action( … Read more
The issue is that when you don’t have any speakers, you don’t have anything to pass to your include parameter. You could solve it by wrapping the code in a conditional so it only runs if there are speakers attached to that post. $speakers = get_post_meta( $post->ID, ‘min_webinar_speaker’, false ); if ($speakers != ”) { … Read more