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
1answer
11 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
33 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
29 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
27 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
15 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
22 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
27 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
20 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 ...
0
votes
2answers
54 views

query_posts different amount of posts per page

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
28 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
28 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 = ...
-1
votes
0answers
37 views

How to select posts with categories by SQL select

Im trying to show some post from a specific category ( from a custom post type) by sql select, I manage to show all post by: <?php $post_date = get_the_date('Y-m-d'); $start_date = date("Y-m-01", ...
0
votes
1answer
7 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
68 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
63 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
32 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
18 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
37 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
15 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
34 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
74 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'); } ...
0
votes
0answers
12 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
15 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
45 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
97 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
49 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 ...
0
votes
2answers
117 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
82 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
28 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
24 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', ...
0
votes
2answers
113 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
72 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
14 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
59 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
69 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. ...
0
votes
0answers
20 views

Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?

I have the following problem with featured tag posts I have a page of a website in wich I want to show only the posts that have setted a specific tag (using the loop). So in this page I have put ...
0
votes
0answers
13 views

Why I have this strange behavior when I try to exlude the featured post from posts visualization?

I am quite new to WordPress theme development and I have a strange behavior with this custom theme on which I am working: http://lnx.asper-eritrea.com/ As you can see in the home page I have 2 areas ...
0
votes
0answers
59 views

Why doesn't my WordPress page show the most recent post?

I was wondering if someone could help me with the following. My news page on my WordPress website doesn't show the most recent blog post, which I want it to do. The code I have is: ...
0
votes
0answers
24 views

Query_post does not get the post_content

When I use before a loop query_posts( '%cat=4'); I get everything, including the post_content field, but when I use the code from here: http://codex.wordpress.org/Function_Reference/query_posts ...
0
votes
1answer
69 views

Get postlist for each category using query_posts?

<?php $cat_name=array('Breaking News Stories', 'Call-out', 'Featured Story', 'Standard Stories'); $count=count($cat_name); /*Get category_id by its name*/ for($i=0; $i < $count; $i++) { ...
0
votes
2answers
496 views

Warning: urlencode() expects parameter 1 to be string, array given in and not getting the preffered output

Warning: urlencode() expects parameter 1 to be string, array given in D:\xamppp\htdocs\sample\wp-includes\formatting.php on line 3690 When I try to give the category_name in the query_post, ...
0
votes
1answer
119 views

query post limits

function posts_limit_fn($limit, $query, $custom_limit = ''){ if($custom_limit !== ''){ return $custom_limit; } return $limit; } this piece of code is executed into an AJAX ...
0
votes
0answers
29 views

How to customize page navigation to different query_posts

I work on category.php For the first page i want to show posts under premium category and [the clicked category link] so i used the query post: category__and' => 4208,$cat_id Then when clicked NEXT: ...
0
votes
1answer
84 views

posts_nav_link on single post template

I have a post type called journal and on the single-journal.php template I am querying the rest of the journal posts like so: <?php query_posts( array( 'posts_per_page' => 4, ...
0
votes
0answers
61 views

Filter RSS feed for custom post type to events for next 7 days only

I'm trying to create a custom RSS feed that shows posts from the custom post type 'events' for the next 7 days ahead only. The feed is already sorted by event start date order rather than published ...
3
votes
1answer
55 views

Query Custom Meta Value with Increment

I have a Query searching for a meta value I have added to my posts (meta-select). I have it feeding out in a loop with 4 results. Let's say I want this loop to start with the meta value "2" and work ...
0
votes
0answers
108 views

archives page ordering posts by multiple custom fields with query_posts

On my archives page, I am displaying posts ordered by a custom field 'date1'. This is the code that I am using, and it works. $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( ...
0
votes
2answers
100 views

Why in this archive page that call query_posts() function show only the last 10 posts?

I am pretty new in WordPress theme development and I am finding 2 problem with this posts archive page: http://lnx.asper-eritrea.com/archivio/ The previous page have to show ALL the blog posts into ...
0
votes
1answer
18 views

Custom query posts error

I have the following code which display different things, that's why I'm using many filters in the query. The problem is that it displays the same thing, no matter the query from the switch. If I do ...
0
votes
1answer
30 views

Custom post query error

i have a ~46k rows in my wp_posts. All i want to do is to query the database that meet my queryes and display the resulted posts but my problem is that any query that i`m doing to the database it ...