Tag Info

Hot answers tagged

2

The p (post) paremeter for WP_Query accetps a single value only: $args = array( 'p' => 100 ); For multiple posts use post__in and pass an array of post ids: $args = array( 'post__in' => array(100, 102, 105) ); See Post & Page Paremters for further clarification.


2

Don't concatenate your id values into a comma separate string otherwise you will have to explode() by comma delimiter which is pointless, instead, if you are getting IDs from some other business logic as evidenced in your iteration over $rows, then build an array of IDs as per the following example: $ids = array(); foreach ($rows as $obj) { $ids[] = ...


2

As an example (adjust to suit your needs): add_action('loop_start', function() { if ( is_single() || is_home() ) echo '<div>'; }); add_action('loop_end', function() { if ( is_single() || is_home() ) echo '</div>'; }); You may need to adjust the conditional statements further if you wish to target archive pages and the like ...


1

You are wrongfully handling the WP_Query parameters. You can either use a query string type input or an array based one. Personally I much prefer the array type, so my example uses it: $category_id = (int) $child_category->term_id; $des_post_args = array( 'post_type' => 'tour', 'cat' => $category_id ); $des_post = new WP_Query( ...


1

All thanks to @PieterGoosen's comment, I figured out that this issue was due to a setting within the WPML (multilingual) plugin. Under the 'translation management'->'multilingual content setup' tab of the plugin settings, there is a section for 'custom posts'. In this section, my 'publications' post type was not set for translation, and this somehow ...


1

I generally merge their ID arrays and make a third query. To keep first set of queries cheap I only return their ID's using fields parameter like this: //setup your queries with extra parameter fields => ids $query1 = new WP_Query(array('fields' => 'ids','other_parameters' => 'etc')); $query2 = new WP_Query(array('fields' => ...


1

Turns out it was the WooCommerce Jetpack Plugin all along. Stupid thing had something enabled which it didn't need. I guess that's what I get if I let a client access the plugin menu. Thank you, denis.stoyanov, for helping me find the solution!



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