Tagged Questions
0
votes
1answer
21 views
Display Posts with template on a Page
OK, I'm sure some WP pros here will think this is a dumb question, and I'll probably get some flak, but I have actually read plenty of documentation, and I just don't think I'm even going in the right ...
1
vote
1answer
130 views
WordPress get posts by date without query_posts
I'm want to get posts from the last 30days in a sidebar but I don't want to use query_posts, is there a way to achieve this with the get posts function?
1
vote
1answer
220 views
query_posts() vs get_posts() multiple loops [duplicate]
I have a template which initially had one single loop and it was using query_posts, I added 2 more loops using the same method, However after reading allot about these it was concluded that I shall ...
0
votes
1answer
30 views
Posts being viewed
I am looking for a way to list posts being viewed but I can't find anything online.
Is it even possible? I've seen some websites that have these loops, "What other readers are currently reading".
...
1
vote
1answer
133 views
Getting movie and serial on actor page
I'm building a cinema site, I came with a problem, let me explain:
Movies- are stored in Post's
Actors- are stored in Post Type - persoane ( taxonomy= lista)
Serials - are stored in Post Type - ...
0
votes
1answer
222 views
Combine query_posts() and get_posts() into single query
I am creating a site which uses normal posts for a blog and the a custom post type for events(generated by the events plugin). I have successfuly used different queries to grab both but I want to ...
0
votes
1answer
344 views
List all posts in a category with query_post() function
I'm a C programmer, konw little about PHP. I built a Blog with wordpress.
Yestoday, I try to create the page www.abc.com/server, this page would list all posts which belong to server category.
I ...
0
votes
2answers
134 views
How to query for a page, get data, then query for child pages of that page
Basically, I want to query PARENT for a bunch of custom field data and echo it out. Then, I want to query all of the CHILD pages of that parent and echo out more data.
What's the best way to do it?
...
0
votes
1answer
162 views
Get posts from current category?
How can i display 5 posts from current category (exclude current post). Order by post time.
Example:
To day news to reading 3 (12/11/2012 - 8:10 PM)
To day news to reading 2 (12/11/2012 - 6:07 AM)
...
1
vote
1answer
110 views
Logged in user ID as post ID
Is there a way to automatically insert the current user ID as the post category name or maybe have WordPress display only the post with a category name that matches the current logged user ID?
...
0
votes
0answers
14 views
How to query for attachments limited to posts [duplicate]
Possible Duplicate:
get attachments for all posts of particular post type
I have a small widget I've created which displays the most recent images which have been added to the blog. I also ...
2
votes
1answer
713 views
WP_Query vs get_posts
I have read a number of questions on SE regarding these but I still can't figure the exact difference wrt usage. Would it be true to say that I would probably use WP_Query for the majority of ...
2
votes
3answers
453 views
Post count per (day/month/year) since blog began
I'm looking to echo the number of posts per month since the blog began, and for months where there was no posts echo '0'.
This is the output I want:
January 1, February 3, March 8, April 3, ...
...
1
vote
2answers
81 views
How do you Query posts with nothing in common?
We can get multiple posts manually in a page, but that's generated in a template, AFTER the default query returned something else (page/post, etc)
How do you query multiple posts in a public query, ...
1
vote
2answers
85 views
Why is querying posts messing up my pages?
I am working on a theme at the moment and I have set up a post template.
This post template is linked to some custom post types.
When I query_posts for my post type on the actual post template ...
2
votes
2answers
119 views
How to get 4 Posts after the 5 most recent ones
Well, I think the question might be a bit confusing. But well, I want to get the recent 4 posts, ignoring the first five recent posts. So in short the sixth, seventh, eighth and ninth - most recent ...
0
votes
1answer
495 views
Query only Posts from Both of Two Category?
I have 3 categories,
1.OnGoing projects(cat id='5')
2.Completed Projects(cat id='6')
3.Upcoming Projects(cat id='7')
and also i have another 2 categories:(Not a Sub Category)
chennai (cat ...
47
votes
3answers
17k views
When to use WP_query(), query_posts() and pre_get_posts
I read @nacin's You don't know Query yesterday and was sent down a bit of a querying rabbit hole. Before yesterday, I was (wrongly) using query_posts() for all my querying needs. Now I'm a little bit ...
1
vote
1answer
245 views
My post repeats itself on the second page [closed]
Hey the way i have my index coded is that it shows one full post and the rest of the post are excerpts, but when i click previous the 2nd page shows the same post from the first page, what can i do to ...
1
vote
1answer
3k views
How to show related posts by category
In my gallery site i want to show other pictures under the current picture (in single post). I seen more codes but it i asks to specify the category, but i dont want want specify the category manually ...
0
votes
2answers
2k views
Get posts by meta data OR title
I have a working query that calls all my posts that have a certain meta value for one of two meta keys:
$term = $_GET['term'];
$args = array(
'post_type' => 'some_cpt_name'
,'meta_query' ...
0
votes
1answer
467 views
Magazine style frontpage with multiple categories/loops and no duplicate posts
I am migrating a static magazine site to wordpress. I would like to have a frontpage displaying multiple categories with a few posts in each, e.g "politics", "environment", "health" and "technology". ...
0
votes
1answer
71 views
Querying a query
Let's say I have a query stored in a array.
I want to parse this array, find the first posts inside this array that match a certain value from a certain key, and so extract the whole post.
Is there ...
1
vote
1answer
788 views
how to exclude “featured” posts from the main loop?
In a category.php template, I built a function that lists "featured" posts before the main loop. The featured posts are selected using a custom field and get_posts():
function ...
1
vote
1answer
4k views
Wordpress pagination with get_posts?
I need to make adjustments to a horribly written WP theme that (a custom theme that was written in tables, and bad code).
The theme has several custom templates, but pagination wasn't used and ...
0
votes
1answer
487 views
Get the ID of the latest post
Been all over looking for the best way to do this.
I want to get the ID of the latest post of a certain post_type.
How can I do this in the cheapest way possible (by cheapest I mean using the least ...
1
vote
2answers
248 views
making random query button using $_GET
Im trying to make my post random when i lick on my button using $_GET but it just keeps refreshing my page instead of refreshing with the random post.
<a href="<?php echo $my_query; ...
0
votes
1answer
3k views
How to display posts by current user/author in a custom page template?
I am a trying to create a dashboard like custom page template that list post of of the current logged in user. I've tried to find a solution on the net. but none were appropriate
2
votes
4answers
2k views
How to return results of a get_posts() in explicitly defined order
I'm trying to create a loop of explicity ordered posts, for example:
<?php $args = array(
'include' => '1,3,8,4,12' ); ?>
<?php get_posts( $args ); ?>
The results are ...
1
vote
1answer
3k views
Query Posts or Get Posts by custom fields, possible?
If I were to take a standard query post.
<?php query_posts('post_type=payment'); while (have_posts()) : the_post();?>
Only this time I would like to query the post by 2 custom fields that it ...
3
votes
1answer
1k views
Is it better practice to use query_posts, WP_Query, or get_posts to create various custom loops within a Page?
Right now, I'm using get_posts to retrieve cusstom posts types with a custom taxonomy assigned to it in order to generate static content like this:
<?php
/**
* Template Name: Front Page
* ...
145
votes
3answers
37k views
When should you use WP_Query vs query_posts() vs get_posts()?
It seems like half the tutorials in the codex and around the blogosphere use query_posts() and half use WP_Query. What's the deal?