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
911 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
866 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
2answers
33 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
207 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
62 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
346 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
168 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
259 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
155 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
53 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
1answer
215 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
44 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
156 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
68 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
278 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
176 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
703 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
93 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
274 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?