Searching by title, content and custom taxonomy

[WP_Query][1] provides list of options including [Taxonomy Parameters][2]. You can use the taxonomy parameter to search the posts like: post_type’ => ‘firma’, ‘post_status’ => ‘publish’, ‘order’ => ‘DESC’, ‘orderby’ => ‘date’, ‘s’ =>$_POST[‘term’], ‘posts_per_page’ =>5 ‘tax_query’ => array( array( ‘taxonomy’ => $_POST[‘term’], ) );

Related Posts function not working

The ultimate answer will be in your server logs, I’m afraid. (You can also turn on debugging in wp-config – sometimes that helps too) But I did notice a few things that hopefully can help you track the issue: <?php // You should not require the $orig_post variable… global $post; // Get the tag ids … Read more

Need help understanding this WP Query [closed]

You can try this code to show only post. if(isset($xt_corporate_lite_opt[‘xt_about_page’]) && $xt_corporate_lite_opt[‘xt_about_page’] != ”) { $args = array( ‘post_type’ => ‘post’); $xt_query = new WP_Query($args); if ($xt_query->have_posts()) { while ($xt_query->have_posts()) { $xt_query->the_post(); the_content(); } } wp_reset_postdata(); } if you have any doubt in WP_Query. then you could check this link in detail. https://codex.wordpress.org/Class_Reference/WP_Query

How to get Custom Post Type with Categories wise in WordPress using wp_query

Your question is very unclear (given that you don’t actually ask a question), but there are 2 problems with your code, both of which are corrected below: $args = array ( //’post_type’ => ‘article’, ‘posts_per_page’ => 5, ‘category_name’ => ‘starter’, // changed from ‘category’ to ‘category_name’ ‘meta_query’ => array ( array ( ‘key’ => ‘recommended_article’, … Read more

construct complex queries with WP User Query

$meta_query_args = array( ‘meta_query’ => array( ‘relation’ => ‘OR’, // Optional, defaults to “AND” array( ‘key’ => ‘_my_custom_key’, ‘value’ => ‘Value I am looking for’, ‘compare’ => ‘=’ ), array( ‘relation’ => ‘AND’, array( ‘key’ => ‘_my_custom_key_2’, ‘value’ => ‘Value I am looking for 2’, ‘compare’ => ‘=’ ), array( ‘key’ => ‘_my_custom_key_3’, ‘value’ => … Read more

Need to know custom code to display random and most viewed posts in wordpress posts and pages

A standard WordPress install doesn’t keep track of visits to pages/posts. So without a plugin there’s no way to know which posts/pages are visited most often. As to finding random posts that’s as simple as: $args = array( ‘post_type’ => array( ‘post’, ‘page’, ‘my-custom-post-type’ ) ‘orderby’ => ‘rand’, ); $query = new WP_Query ($args);

Random posts that always include a particular post?

Try this code:: post__in (array) – use post ids. Specify posts to retrieve. ATTENTION If you use sticky posts, they will be included (prepended!) in the posts you retrieve whether you want it or not. <?php $parent = $post->ID; $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $query_args = array( ‘post_type’ => ‘page’, ‘post_in’ => array(‘post_id_to_include’), … Read more