Tag Info

Hot answers tagged

1

We will use a small piece of the logic from my previous answer in this appraoch. We need to do the following: Get an array of post ID's from the query we have run to get our post limit of 100 Use the current post ID and search for that specific post ID in the array of post ID's Use the array key where our values match, add 1, and return that as our rank # ...


1

You're right. It isn't a good structure. You are running three queries on the page-- the two you are creating plus the main query that is being completely ignored (plus ancillary queries). You are also clobbering the main query halfway through the page load when you overwrite $wp_query, which can cause unexpected and unpredictable results and difficulty ...


1

Assusming you are using V1 of the WP-API, did you tried the following endpoint: http://www.example.com/wp-json/posts?filter[category_name]=pink+warm I'm looking at the code in WP_JSON_Posts class and the get_post() should be able to handle that use case. UPDATE: It seems there is a limitation with the way the query is built. Here is a potential ...


1

Per comments, just use pre_get_posts filter (no query_posts()) very much as you have it with a few adjustments, eg test for $query->is_category( 'news' ) so that it only runs on news queries, and set the default to "2014" rather than bailing on no $_GET, eg function wpse129223_custom_meta_query( $query ) { // If not on the main query, or on an admin ...



Only top voted, non community-wiki answers of a minimum length are eligible