The get-posts tag has no wiki summary.
0
votes
1answer
14 views
0
votes
1answer
26 views
Getting the list of the latests posts and custom type posts in the homepage
When I need to get a single post type list I usually use get_posts, how can I retrieve multiple custom posts types to populate the site homepage?
To be more precise, I would like to get the latest ...
0
votes
1answer
26 views
Exclude post format from get_posts
The title basically says it all.
I know I can use the following to get posts from the aside post format:
$args = array(
'post_type'=> 'post',
'post_status' => 'publish',
'order' ...
1
vote
1answer
39 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 ...
1
vote
1answer
42 views
How-to exclude terms from the main query the most performant way?
This Q is a follow up to this answer on the Q: "How to exclude a specific term for the search?".
4 ways to filter out posts that have a specific term
Type | Pro | ...
0
votes
1answer
31 views
Why would get_posts be ignoring posts with 2-digit ids?
I'm using this code to list child pages of the current page and similar code to get child pages of all ancestors to use in a sidebar contextual hierarchical nav menu:
$pageset = ...
1
vote
4answers
53 views
How to get all posts related to particular category name?
I am developing one project and in this project i have to display all the posts related to particular category name.
I have searched a lot but i haven't got any idea to implement this.
How can i do ...
0
votes
1answer
56 views
the-events-calendar, pagination with tribe_get_events()
i'm using the events calendar plugin and at some place i use the tribe_get_events() function to show the upcoming events. Point is, i need to create a pagination for those results.
The ...
0
votes
1answer
43 views
get_posts() method and paging is not working
Trying to use paging in one of my Wordpress site but seems it is not working.for paging i am using SEO Pager Plugin.
here is my code
$params = get_query_var('args');
$ppp = ...
0
votes
1answer
56 views
how to call the category of the post
I jus want to create a gallery which shows either all or certain number of posts in that category under each post and i found a working code
<?php
$displayposts = new WP_Query();
//get posts ...
1
vote
1answer
38 views
List most recent image uploads, but only for specific custom post type
I can get a list of the most recent image attachments like so:
$attachments = get_posts( array(
'post_type' => 'attachment',
'posts_per_page' => $number,
'post_mime_type' => ...
0
votes
1answer
27 views
Location-Based Pages displaying results near customer
I'm creating a website where the customer will enter their postal code and the pages (with a distance selected of 5, 10, 20 miles) will display on either a Google map or Bing map. The page results ...
0
votes
1answer
48 views
Random Image Script Working but Want to Avoid Duplicates
I'm using the following to display random images:
<?php $new_query = new WP_Query('&showposts=24'); ?>
<?php while ($new_query->have_posts()) : $new_query->the_post(); ...
0
votes
1answer
44 views
Can I include get_posts in this array?
I am using the custom meta box script from deluxeblogtips.com and I wondered if I could include get_posts within this array so that it displays all posts within a set post type ("Locations" for ...
0
votes
1answer
53 views
get_posts not working as expected
I'm trying to get posts from 3 different categories and list them on the front page:
// Carousel articles
$args = array( 'numberposts' => 3, 'orderby' => 'date', 'category' => ...
0
votes
1answer
23 views
How do I get posts by multiple post ID's?
I've got a string with post ID's: 43,23,65.
I was hoping I could use get_posts() and use the string with ID's as an argument.
But I can't find any functions for retrieving multiple posts by ID.
Do I ...
0
votes
1answer
96 views
paginate posts on admin page
I've created a plugin that calls a list of posts and grabs external API data. I am using get_posts to grab the list (because I need to feed the array of links into the API query)
For whatever reason, ...
0
votes
2answers
136 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' ...
-1
votes
1answer
41 views
How to show only text from post in WordPress
How do I retrieve just the text of a post in WordPress not including any pictures?
-2
votes
1answer
31 views
append $_GET parameters to post
I try to find a plugin that can "auto insert" to post edit/add page a parameters by fill $get paramerts: for example:post.php?title=a&tags=ss,dds,aa
Ideas?
0
votes
1answer
120 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
51 views
How to query with get_posts() for posts with any tag
I need to do a simple post query that will get any post that has at least one tag. This is my current code that gets the posts with tag ID 27 or 36, but I need to modify it to get all posts with at ...
0
votes
2answers
37 views
get post id using custom filed value
I'm having custom field "prime" with values yes or no. I want to get the post id's with selected value "Yes".How can i get that.
Thanks in advance
0
votes
1answer
48 views
Load posts from external source if not found in database
I want to modify WordPress so that it requests content from a function if content is not found in the database.
I want to edit the section of the code which requests and returns the post content ...
0
votes
0answers
35 views
Issue querying pages based on template
I'll try and make it brief. This snippet:
get_pages(array(
'meta_key' => '_wp_page_template',
'meta_value' => 'page-news.php',
));
Is not behaving the same as the ...
0
votes
1answer
37 views
Getting the Posts' permalinks from XLMRPC
I'm new to WP and I must fetch pages/posts from a blog in another subdomain.
I'm using ZF to do this. I've recently found out the getPages doesn't get me what I want (posts; duh!). I didn't see any ...
0
votes
2answers
122 views
get_posts only children from certain parents
I have parent posts (custom post type hierarch=true) with ID 1, 2, 3, 4.
The parent posts with ID 2 and 4 have child pages.
I need to retrieve only posts 2 and 4 and all of their child pages.
...
0
votes
0answers
55 views
Get Pages and its child pages based on meta value - UPDATED with solution
Tricky one.
I have a client with custom post type - products
Products are in structure:
A
a1
a2
a3
B
b1
b2
b3
On parent page A and B I have a meta-field where client can set if show the page ...
0
votes
1answer
42 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 ...
0
votes
0answers
28 views
Comparing two get_posts requests in order to avoid doublons
I use a custom request to populate a slider, and then I have another section with a different request.
i've come up with something :
/* recup de la requete slider pour comparaison */
$slider_posts ...
0
votes
1answer
81 views
query_posts breaking when a large number of results on one server
The following code:
$params = array(
'post_type' => 'game',
'post_status' => 'publish',
'posts_per_page' => -1,
);
$posts = get_posts($params);
works fine on my dev ...
0
votes
1answer
39 views
Get posts in archive page
I am using this code to show posts in columns. How can I set this part ('cat=3&numberposts=5&offset=0') as so archive page should automatically get posts from clicked catagory?
<div ...
0
votes
1answer
118 views
Get_Posts and multiple categories
I have created a custom query in hopes of showing the top posts from some child categories. It appears here: http://www.sitesofconscience.org/activities/whats-new
The query has a big flaw: some posts ...
0
votes
0answers
60 views
wp-postratings thumbnail voting only effects first thumbnail
I have a problem with voting using wp-postratings. I have a overview page with multiple thumbnails and want users to vote on this page. Problem is that the voting on all displayed thumbnails effects ...
1
vote
2answers
171 views
Only retrieve posts where post_excerpt has been filled out
I'm trying to use get_posts to only return posts that have an excerpt. Done lots of searching and have been trying to use "posts_where" filter on the query but my SQL is lacking. This is what I'm ...
1
vote
1answer
156 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
votes
1answer
22 views
Put posts (ID1,ID2,ID9) in the Loop
my Question: I would like to display my posts like this in the loop:
Example: Show me articel with the ID1 , ID2 and ID9.
Loop start
{
Articel I (ID1) AND Meta_values;
Articel II (ID2) AND ...
0
votes
1answer
62 views
Using get_posts with arguments found in meta keys
I am using get posts, but I need to refine the query based on posts where a certain meta_key has a certain value.
Something like this
<?php $reviews = ...
2
votes
2answers
185 views
get selected post using $_GET
im trying to get a post info when I click a button on the post and make it echo out the the same info it has in the else function, I tried adding in a query but in return it makes it echo back all the ...
0
votes
1answer
330 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
233 views
Can I use numberposts=-1 and offset together when using get_posts()?
I'm currently using get_posts() for a little part of a theme I'm working on. However, I've run into one little hiccup.
If I want to show all posts for a category, I set the 'numberposts' argument to ...
0
votes
3answers
109 views
get_posts not working on homepage?
I have a simple custom shortcode plugin where you give it a tag and it'll display the titles of all the posts with that tag.
e.g. In my post if I type "[listposts tag=oct-2011]" it will output the ...
0
votes
1answer
173 views
get all categories' latest post in one query
My WP blog has 12 categories, 80 subcategories.
I need to fetch the latest post from each of those 12 categories.
I know how to do it in 12 queries using 12 get_posts() but is there a way to get ...
1
vote
1answer
158 views
Exclude Current Post from Recent Posts Loop
what would be the best way to exclude the current post I am viewing from this recent posts query. Thank You!
<?php
global $post;
if (in_category('top-lists')) {
...
2
votes
2answers
66 views
How to generate a list of posts published on current day?
I want to create a page labeled "Today's News" which displays a simple bulleted list of all posts published on the current day and grab the current date based on the server's date/time. Is this ...
0
votes
1answer
150 views
WordPress pagination of get_posts or get_children
I'm trying to get a specific post's images (attachments) with a pagination (display 10 images per page or something) Is this possible?
I'v searched a lot on Google and I can't seem to find a correct ...
0
votes
2answers
314 views
exclude category from get_posts?
getting posts by cat with get_posts but need to exclude another cat called london or id 10. is this possible?
best, Dc.
// array(7,-10)
$laargsM = array('category' => 7, ...
1
vote
2answers
138 views
Trouble using get_post
For Microkids related post plugin (http://www.microkid.net/wordpress/related-posts/)
He said "Using the get_post() function you could get any data you need from the related posts." and he posted this ...
1
vote
1answer
78 views
get_posts that haven't been assigned a specific custom field
I'm trying to use get_posts() to pull articles that have not been assigned a specific custom field. For example (not working):
$articles = get_posts(array(
'post_parent' => 0,
'post_type' ...
0
votes
1answer
55 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 ...