Set up The Loop with query parameters. This will override the current WordPress Loop and shouldn’t be used more than once. This must not be used within the WordPress Loop.

learn more… | top users | synonyms

0
votes
2answers
109 views

How to make an archive page displaying posts in a date range

I'm trying to make a couple of Page Templates for different Pages that should act as an archive to display posts (a Custom Post Type actually) in a certain date range. The website it concerns is ...
0
votes
1answer
118 views

Custom query - get_the_terms not work

I want to to show my customer works in a slide This is my query to show these works. I want to obtain the term of the taxonomy "idm_real_tax" for each custom type record. $query = new ...
0
votes
1answer
161 views

3 Posts in Loop, Show Stickies First

Okay I am starting to wonder if it is even possible to do this! As I've found very little info on the matter online. This is a fresh WP install that I've been experimenting on so that I can work in a ...
2
votes
1answer
184 views

Add field to posts (checkbox) that only one post can have

I am trying to add a field to Wordpress posts (not pages) which would simply include a label and a checkbox. Something like: Make this the sticky post? If check, the key should be set to TRUE or ...
3
votes
3answers
187 views

Query posts distinct authors

I am trying to get post from a category ordered random, but making sure that the author does not repeat itself. So I have this query which works as intended, but there is the chance that the author ...
0
votes
1answer
20 views

How to put forward a blog post

I would know if I can put forward a blog post natively using Wordpress ? For example, I have created 20 posts, but I only show 5 on my homepage. Then imagine that I want to put the 18th at the first ...
0
votes
1answer
103 views

Display 2nd category, only once, as sub-heading, in the loop

I have a Custom Post Type ("Rental"). I am using the code from this article I found to display Rental custom posts on a page, with the Categories of a custom Taxonomy ("Region") as headings between ...
0
votes
2answers
72 views

WordPress custom post type queries

I'm using custom post types and listing them in single-[customposttype].php?type=example <?php if (have_posts()) : while(have_posts()) : the_post();the_content(); endwhile; endif; ?> Now I ...
0
votes
1answer
26 views

query_posts clarification needed

I understand for the most what query_posts does and how it works. I also know it's not good practice to use it. But I would like to know exactly what the "$posts" variable does in this setup: ...
0
votes
0answers
40 views

Optimising specific Query with ACF meta objects

Is there any way I can improve the following query without touching the server, as it's taking around 5-6 seconds to execute, the SQL is outputing as: SELECT wp_posts.* FROM wp_posts INNER JOIN ...
0
votes
0answers
33 views

post by Category not working after setting 4 post per page

I am trying to show 4 posts on my homepage that is working fine but whenever i click on sidebar post categories it still shows the 4 post from homepage i.e the filter doesnot works and it shows 4 post ...
0
votes
0answers
69 views

Order posts by ACF checkbox

I would like to order the posts (archive.php) by listing the ones with the ACF checkbox "Premium" first, could someone please offer some advice?:) This is what I've tried so far: <?php echo ...
0
votes
2answers
81 views

display news with pictures 3 small and one large (loop)

I'm trying to put 4 news with pictures 3 small and one large, have gotten displaying them but the "large" is repeated with the last "small" <?php $b=1; $args = array( ...
0
votes
0answers
102 views

Query Posts with meta_query key in array

I am trying to query posts using meta_query to get a series of dates stored as an array in the key repeat_intervals. I am able to query the first date using the following: global $post; query_posts( ...
0
votes
1answer
86 views

query_posts() with multiple meta data comparisons

I have a bunch of posts belonging to category 6, each having the same meta fields. I'm interested in two fields in particular: "pce_monday_open" and "pce_monday_close", both of which have numeric ...
0
votes
1answer
342 views

Query post order by post and desc not working

I have a query that displays post the order of the post 1 to 10 and front-end added: <?php print intval( $post->menu_order );?>º there shows 1º, 2º, 3º ... 10º must reverse the display but ...
0
votes
1answer
291 views

How to use filter hook posts_join for querying taxonomy terms in posts_where?

For the last few hours, I have been trying to use the filter hooks posts_where and posts_join to search for posts based on taxonomy terms, in this case, the taxonomy is 'category' and the term is ...
0
votes
1answer
130 views

WP_Query condition affects posts_per_page count

I'm trying to create a new WP_Query that displays the last 5 posts from cat 1 that doesn't have a thumbnail. This actually works: <?php $the_query = new WP_Query( 'cat=1&posts_per_page=5' ); ...
1
vote
1answer
42 views

List children on child post

I have a custom post type with children posts. If I'm viewing one of the children post how can I list other children posts that uses the same parent?
0
votes
1answer
274 views

List all posts in taxonomy term

I have a custom post type called anime and a taxonomy called series. If I view any post and that post belongs term Banana it should list all the posts in term Banana in a dropdown list. Here's the ...
0
votes
0answers
35 views

Auto create child post from custom field?

I have a custom post type that has 3 custom fields. If I create a post with data filled in those 3 custom fields I want it to auto create child posts for each custom field & using the data from ...
0
votes
1answer
57 views

Wrong post title displayed from loop

I'm building my own theme. I have a page set for my blog (with a template that I made) which I'd like to just display a few of my posts. It uses the following loop: <?php ...
0
votes
0answers
58 views

Advanced Custom Fields shows all posts

My ACF plugin shall only show posts with my organisation type = socialbusiness. Somehow it doesn't even care about my meta_query, it also doesn't care about the categories I selected (it shows "blog" ...
0
votes
1answer
52 views

2 queries with counters

I have 2 loops on a page both containing a counter to implement slightly different code every 6 posts. For some reason though the second loop is implementing the different code sometimes after 4 items ...
-1
votes
1answer
359 views

query_posts different amount of posts per page [duplicate]

I have a posts_per_page query to paginate multiple post types, which works great! Now though, as it paginates it to show (in this case) 100 posts per page, I'm wondering if you can show 100 on page ...
0
votes
1answer
37 views

Query all post types but limit to parents

I'm building a site with several post types and am using a single index.php to query the archive for each one in turn. One of these post types is hierarchical and I'd like to just query the parent. I ...
0
votes
1answer
178 views

post_parent array doesn't work

I have a problem. I created a shortcode to show a galerie. I used query_posts to fetch all posts of a parent post and get the data from there: function galerie_baureihe() { $parent_id = ...
0
votes
1answer
16 views

get “read more” with custom DB query like you would with WP Query

I am using a custom database query to fetch posts. In the post I have a break tag, which is displayed as <!--more--> in the database wp_posts table, but I can't get it to output like I would if ...
1
vote
2answers
193 views

List posts in alphabetical order

What I'm trying to achieve is to set the list shown in alphabetical order. Any thoughts on how i can successfully achieve this? I have pasted the snippet below for reference. <ul ...
-1
votes
1answer
124 views

limit number of post for achive page

Im trying to limit the number of post for my archive page, in a specific category. I've manage to display post from just the category I desire, However, if i setup a loop to limit the number of ...
-1
votes
1answer
101 views

Create “archives by year and week” by category template

I'm trying to figure out a problem quite tuff; I explain myself; I have my pages ( which are in fact a category template). I take for example this website: http://www.irishpost.co.uk/ Where the ...
0
votes
0answers
57 views

Sorting with custom field and 'comment_count' - orderby

How can I also add comment_count to my existing query? Below query works fine and sorts the archive with highest rating_avg only, I would like to sort my archive using rating_avg first and then the ...
0
votes
0answers
78 views

Carousel with most viewed posts from last 7 days

I'm looking for a way to display the most viewed post from the last seven days into a carousel ( displaying the image thumbnail, and the title). I'm using a existing carousel, and trying to tweak it ...
0
votes
1answer
26 views

Custom pagination generates title 404

I know it's a common problem, but I tried every solution appeared on this stackexchange. Every solution has failed (maybe because I'm still a newbie). I've this query on index.php page: if ( ...
1
vote
1answer
51 views

Order posts by condition

I need to get 15 posts. If there are any with a tag featured, I want them to be first. If there are none, I want the rest to be random posts. My idea was to sort posts based on a condition ...
0
votes
1answer
198 views

query_posts with offset breaks pagination

I have this code in my front-page.php template: <?php if (get_query_var('paged')) { $paged = get_query_var('paged'); } elseif (get_query_var('page')) { $paged = get_query_var('page'); } ...
1
vote
0answers
37 views

How do I make query use exact post title

I am creating a custom search query in wordpress and the post title isn't matching. I want it to say the posttitle and the firstname have to be exact matches, or nothing should come up under the ...
0
votes
0answers
20 views

Modified query_string has stopped working in WP4

The code blow was used to load a filtered taxonomy archive and worked fine up until the release of WordPress 4.0. Since upgrading to 4.0, it's not returning any results. Any ideas what might have ...
0
votes
2answers
264 views

ascending order custom post type

I'm trying to sort a custom post type in ascending order (instead of the default descending). Registering the post type like so: function codex_custom_init() { register_post_type( 'calendar', ...
3
votes
1answer
283 views

Improve or optimize a very slow query

I have a fairly large database - 113,299 rows in wp_posts and 216,0649 rows in wp_postmeta. There is one custom query that I run after a post is added or edited, which appears in MySQL's slow-log ...
0
votes
2answers
88 views

Show single posts date, in a page of posts

In a page of posts, how do I show their date, instead of the page date? I have no php knowledge. Let's say I want to show the single posts date here, instead to the single posts title. <?php ...
2
votes
2answers
1k views

Get post ids from WP_Query?

Is there a way I can retrieve an array of post ids queried from the following: $latest = new WP_Query( array ( 'orderby' => 'rand', 'posts_per_page' => 3 )); if ( ...
0
votes
0answers
283 views

Display page content inside a onclick popup or fancybox or lightbox

I'm doing a single page theme. So in that I would like to have some links which load the page content of the page inside a fancybox or lightbox. I've already tried Best way to load page content in ...
1
vote
1answer
35 views

Inserting custom data to the_post() during loop

I have some posts on my WordPress site, and let's say I want to add a random number for each post with $num as key and random() as value. Then I want to access them with something like: $post->num ...
0
votes
1answer
44 views

How to get only current images of a post

I am new to WordPress. I have created a template page where I want to show single posts, So to get media of that post I am using a function $args = array( 'post_type' => 'attachment', ...
1
vote
2answers
249 views

Order by meta value, pro first, then free

query_posts($query_string . '&meta_value=pro&orderby=rand'); I get pro list with random, but I want pro as well as free, but with pro list first, then meta_value free list. I also set ...
0
votes
0answers
121 views

Ordering posts alphabetically by meta keys and title

I have a query for custom posts and I have managed to order the results alphabetically based on the title first then a 2nd alphabetical ordering of the 1st of 2 meta keys "Species". This works great. ...
0
votes
0answers
16 views

Query Post Using Date custom field which has series of dates

I am working on a golf course booking website. The booking dates are stored using a custom meta box in a textbox like this 2014-09-26, 2014-09-29, 2014-10-01, 2014-10-05, 2014-10-06, ...
0
votes
1answer
198 views

Posts per Page on custom Taxonomy Template

I'd like to show 20 posts on my custom tax template, using this filter: function customize_customtaxonomy_archive_display ( $query ) { if ( ( $query->is_main_query()) && ( is_tax() ) ...
0
votes
0answers
138 views

Sort Posts By Custom Field Date

I know it's not a new question, but everything I found fails to sort my posts. I simply want to sort 30 posts that have a custom field, let's say "album_date_sort", by the date entered in its value. ...