Articles of wp query

Displaying Posts Related to Other Posts by a Taxonomy Term?

I have a custom post type for musician’s profiles, and a taxonomy for their location (categorised hierachically into Countries and then Cities). On the musician’s individual profile pages I need to display a list of musicians in the same city (i.e. the child taxonomy). It’d also be good to display posts in the same country […]

Order by multiple meta key and meta value

How can I set multiple meta keys order by meta value, can any one give me some example?

Add custom post type items from frontend

I am trying to figure out on how do I make my wordpress website to be able to add portfolio items from the frontend. Plugins such as WP-User-Frontend allows posting from frontend but only works with blog posts. Is there any ways or any plugins similar to wp-user-frotend but being able to add custom post […]

Exclude first 5 posts of specific categories in the main loop

I read this article about how to set an offset for one specific category in the loop. I was wondering about if this was possible for more than just one category. My problem with the code suggested in the article linked above is that I am using a single widget to show five posts from […]

Query to return maximum of one post per author

We are introducing a “featured author” area on our site and would like to display the most recent articles by a select group of authors. However, we only want a maximum of one post per author to display. So an author could potentially have posted 5 times since another author had posted, but regardless only […]

How to get the posts published in last two days using WP_Query?

I am trying to loop through all the post to get the top most shared posts on social network. I want to use the date_query parameter in the WP_query to get the posts of last two days , last 5 days, last 7 days and last 9 days. How can i implement it through using […]

WP Query to get all posts (including in draft/pending review)

I currently have the following query: $args = array( ‘post_type’ => ‘post’, ‘orderby’ => ‘title’, ‘order’ => ‘ASC’, ‘posts_per_page’ => 10, ); $my_query = new WP_Query($args); while ($my_query->have_posts()) : $my_query->the_post(); ?> This returns all the posts that are published. How can I alter it to show every post whether it’s published, pending, or in draft?

Make First post different from rest?

Hi i’m using the code below to call post from a certain Category under certain post types, But how do i style it so that i can make the first post different from the rest of the post. <?php $queryObject = new Wp_Query( array( ‘showposts’ => 4, ‘post_type’ => array(‘pretty-little-liars’, ‘revenge’, ‘once-upon-a-time’), ‘category_name’ => celebrity, […]

Order terms inside a select dropdown

I’m working on a project where I’ve a dropdown of all the terms inside a taxonomy. If the user selects a term, then a function is executed. Eveything is working great, but I can’t get that dropdown orderded by name. Do you have any idea of what the problem may be? I’ve a list outside […]

Compile two queries to one set of results?

I’ve got a big query that queries one post_type with all different kinds of filters. Values are taken from <form> inputs. Im adding 3 different checkboxes to the <form> which can be used as post_type toggle – this means that you can query only one post_type of the three, two of them or all at […]