get_posts() is a function for creating multiple loops. It retrieves a list of latest posts or posts matching criteria.

learn more… | top users | synonyms

0
votes
2answers
994 views

get_posts displaying wrong permalink for “continue reading” link

I lifted the "continue reading" link functions from the Twenty Eleven theme and for the most part, it is working (works in RSS feeds). I created a shortcode to display the latest post on the front ...
0
votes
1answer
68 views

Use get_posts() with 'post' and 'page' queries at the same time?

I'm trying to grab all posts which are 'posts' and not in category '3' and '5' and which aren't 'pages'. Is this possible to do using one single get_posts()? Because I'm querying both actual posts and ...
0
votes
3answers
82 views

Is it possible to retrieve a post and its metadata at the same time?

I usually use two steps to retreive a list of posts and the associated metadata: call get_posts(or a custom WP_Query), and then loop through each post returned and retrieve each posts metadata one by ...
0
votes
0answers
616 views

How do I paginate a get_posts() request inside another page loop (Paginating childpages)

The heading says a lot, so I'll repeat it here "How do I paginate a get_posts() request inside another page loop?" I'm using a page to display child-pages and I need to paginate them. Edit: Should I ...
0
votes
4answers
396 views

Why always one post missing

In my custom query, every time I query for posts from a particular category using WP_Query() and the category has 10 posts for example, I seem to be missing a post. So querying for 10 posts only ...
0
votes
1answer
67 views

How do I query posts and have their related taxonomies returned in the results?

I have created a custom post type that contains television channel data. Each channel has its own post. I have also created a custom taxonomy of channel groups. What I want to do is query all the data ...
0
votes
1answer
536 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
2k 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 ...
0
votes
1answer
888 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
134 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
1answer
147 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
1answer
4k 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, ...
0
votes
2answers
949 views

attachments with tags and get_posts

having problems with filtering a posts attachments by tag... It worked fine until i added the tag__in arg (and other variations of it). $vidArgs = array( 'tag__in' =>5, ...
0
votes
1answer
884 views

Function to get content by ID

I'm trying to get text only content of posts by ID. I modified this function as follows, but at the moment it returns nothing. I cannot see what's wrong with it. function get_the_excerpt_id($post_id) ...
0
votes
1answer
186 views

How to create a custom loop ordered by Categories on a Page Template?

Ex. Category 1 Post 1 Post 2 Post 3 Post .... Category 2 Post 1 Post 2 Post 3 Post .... Category .... Post 1 Post 2 Post 3 Post ....
0
votes
1answer
25 views

WordPress - List Sub Categories and Sub-Sub Categories, With Posts

I have the following code. It allows me to show sub categories and documents within them. The thing is, a sub category may contain further sub categories. The code below will show documents belonging ...
0
votes
2answers
36 views

Display all Post titles with Category and Tag

I am trying to display all posts that are in a specific category and have a specific tag. This is what I have so far but it seems to ignore the & and make it or. <?php $myposts = get_posts( ...
0
votes
4answers
560 views

How to limit get_posts()?

I've been researching this for the last 3 days. I'm triyng to limit the maximum amount of posts retrieved by get_posts(). I have this chunk of code: // all filters should be applied here $args = ...
0
votes
2answers
66 views

show posts in different styling

I would like to show categories in the front page with different behavior: categories to show posts in two styles [Three posts having the same style and then another two with the same style] ...
0
votes
2answers
409 views

get posts from 2 categories. (2 posts)

I have a custom post (it's called "items") and 2 categories there. 1. on category page, I need to get posts which belong to 2 categories. get posts from category1="Food" and category2="featured" How ...
0
votes
2answers
2k views

Pagination with get_posts seems to work but links not showing

I've a custom page template where I want to query 2 posts from a post type and 1 post from another post type. I have it set up like this: $paged = get_query_var('paged') ? get_query_var('paged') : 1; ...
0
votes
1answer
170 views

Efficiently loop over huge number of posts

I want to loop all posts to do some processing, but one of my concern is there are many posts and it might used up my memory, so I want to loop posts with offset, something like paging. e.g. $posts ...
0
votes
1answer
310 views

Change attachment inside the_content using filters

I am in search of a snippet or function that will filter the embedded images inside a post to a custom size I have defined in functions.php. Here is the scenario: A client uploads and add any ...
0
votes
1answer
166 views

get_posts includes “auto drafts”?

I'm using get_posts to generate a list of posts. $args = array( 'post_type' => 'post', 'numberposts' => -1, 'post_status' => array('publish'), 'orderby' ...
-1
votes
1answer
63 views

how to ask if in two categorys inside if

I'm new two wordpress so sorry in advance if this question might be very basic. Depending on which category a post is, I do some script things and I ask inside the loop in this way: <?php if ...
-1
votes
3answers
39 views

Custom Post Type meta value is being saved in array, instead of just the string (as value)

So, this is how WordPress is saving my CPT meta: array(8) { ["product_id"]=> array(1) { [0]=> string(10) "abcdefg987" } ["end_date"]=> array(1) { [0]=> string(10) "02-02-2015" } ...
-1
votes
1answer
221 views

Multisite pagination with get_posts

I'm looking for a way to paginate my get_posts : $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'posts_per_page' => 5, ...
-1
votes
2answers
70 views

Latest post on specific category and custom css

I'm trying to create a new home page with two columns for latest post of specific category. This the page code: <div id="left-column"> <div class="bloccorosso">News & ...
-1
votes
1answer
287 views

Display post's description and caption

I am trying to get and display 5 featured posts. To achieve this target I have an offset of 5 recent posts. I have successfully fetched the posts' id's and images, but I failed to get every post's ...
-1
votes
1answer
72 views

show custom post's post in two different divs [duplicate]

I have created a custom post type. For that I have used this code add_action( 'init', 'broker_post_type' ); function broker_post_type() { register_post_type( 'new_broker', array( 'labels' ...
-1
votes
1answer
361 views

posts_per_page - Repeats only first posts 'post__in' array

This question correlates with a previous question I was able to solve here: http://wordpress.stackexchange.com/a/137929/28389 I am using an array for 'post__in', and I am able to run this no problem. ...
-1
votes
1answer
191 views

get posts based on category and post meta

I am coding a Live Show box for a radio website to show who is on air and who is up next. I've been using the get_post function to retrieve posts based on the category (in this case the day of the ...
-1
votes
1answer
739 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
94 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?
-3
votes
1answer
304 views

Get all posts without tags

I'm working with a tag plugin. Is there a WordPress way to get_posts or query all posts that have no tags?