0
votes
1answer
39 views

How to create content automatically when a post is published?

Goal: Ability to automatically create content in WordPress posts/pages. Goal Details: When a post is created/published, it will automatically create or configure content based on the base data inputs ...
0
votes
1answer
22 views

get_posts() forcing ignore sticky posts on main loop

I have a custom query using get_posts() that besides ignoring sticky on its main query, ignores sticky posts on main loop. Reading around I've found that get_posts() have some trouble with sticky but ...
0
votes
1answer
24 views

what is the maximum number of post a wordpress loop can work with?

what is the maximum number of post a wordpress loop can work with? how many post can i display with 'posts_per_page' => -1? ive got 50,000+ pages and I want to sort through them, but I just get ...
-1
votes
1answer
41 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' ...
0
votes
2answers
68 views

Retrieving 3 latest post from each of 5 different custom post types

I have 5 different custom post types. I am showing 15 latest post from them on my home page using following query: $query = new WP_Query( array ( 'posts_per_page' => 15, ...
-1
votes
1answer
154 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
vote
1answer
154 views

How do I restart my loop with get_next_post()?

I'm looking for a succinct method of making get_next_post() double back to the beginning once it hits the last post. Currently, it stops once it hits the final post. Here are a few lines of code from ...
0
votes
3answers
126 views

Get post offset/posts page offset in single post page (outside the loop)

I would like to know how I could get the offset of a custom post or its page, outside the get_posts loop. I developed an external web application which connects to the wordpress blog with JSON API ...
0
votes
1answer
86 views

get_posts and wp_autop (remove filter)

I just transformed my query_posts function in a get_posts function. Here is my old function: <?php // The Query query_posts( 'cat=170&showposts=4' ); remove_filter('the_excerpt', 'wpautop'); ...
0
votes
1answer
60 views

get_posts output always same post

I'm trying to output the last (chronologically) 4 posts having the tag (slug) "pp". <ul> <?php $args = array( 'posts_per_page' => 4, 'taxonomy' => 'tag', 'field' => 'slug', 'terms' ...
0
votes
1answer
104 views

Is get_posts() more efficient than The Loop?

In category.php, I want to get list of posts in that category. I found two ways: using get_posts($args) and The Loop. get_posts() way $args = array ( "category" => ID ); $posts = ...
0
votes
1answer
34 views

Why only one post (and no pagination) on this variation of the loop?

This is my WP loop: // fetch latest news stories $paged = (get_query_var('page')) ? get_query_var('page') : 1; $posts = get_posts(array( 'numberposts' => 3, 'paged' => $paged, )); // ...
0
votes
1answer
262 views

get comments and get posts in loop

I need to get posts done by specific users and get also comments done to these posts, so far I can get the posts and comments but can't get how to do it in loop properly, because now I get the same ...
0
votes
2answers
99 views

Transient Loop Not working as expected

So I created a transient object that used get_posts() to get a series of posts based on some argument. Well the transient was stored - it was created - YAY - now I tried to write this loop: public ...
0
votes
1answer
850 views

Need some help with “the_widget()” function

I am trying to create code to display certain default WordPress widgets on my e-commerce site. I have 6 content boxes which display WordPress widgets: • Pages • Latest Posts • Archive (last ...
0
votes
1answer
42 views

Is there a way to target only images within the loop?

I'm new to WordPress and I'm trying to target specific parts of the content. I understand how to grab the title with get_title() — is there something similar for images?
0
votes
0answers
306 views

Show all posts using the template page and the loop?

I am trying to make a template page that would display all posts from all categories, in short - every post added to my website. I was googling around and found out that it can be done by using The ...
0
votes
1answer
1k views

Advanced Custom Fields: Post Object - Not returning data [closed]

I have a custom post type called "Training" with an archive page (archive-training.php). I have another custom post type called "Courses". I am using Advanced Custom Fields: Post Object to link ...
0
votes
0answers
296 views

Showing sticky posts with get_posts()

I'm using this to retrieve posts on my index page: <?php $posts = get_posts( "category=13&numberposts=2" ); ?> <?php if( $posts ) : ?> <?php foreach( $posts as $post ) : ...
1
vote
1answer
2k 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
449 views

Show last post from multiple categories using wp_list_categories

I have the following code that lists out the children categories on a separate page when you click on its parent category. The code renders a list like so: Home › Archive for IQ Issue 7 Journal ...
0
votes
2answers
223 views

How to Make infinite loop of post

I am using Post contents as a slider contents, i need to make the post infinite number of loop, ie, If i view the last post after that first post should display and before first post the last post. ...
0
votes
1answer
125 views

Displaying posts on Homepage

I am wondering how to add a column to my homepage that shows the five most recent posts from the blog page located under the "Latest News" heading. Here is the link to my development site. ...
0
votes
1answer
226 views

get_posts() seemingly ignoring post_type

I am trying to grab posts of post type "leads" (see below for the code I am using) however the query produced (obtained via debug queries) is including the clause 'where post_type in ("leads", ...
2
votes
1answer
1k views

Is it necessary to reset the query after using get_posts()?

Is it necessary to reset the query after using get_posts() ? I have been looking at this page and I don't see any reference to get_posts() ... I can't make it out for sure from this page either. I ...
3
votes
1answer
2k 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 ...
0
votes
3answers
164 views

Delist entries in the_loop

I am trying to add a delisting feature to my WordPress network. Posts which are delisted would not appear in post lists, but would still be visible if accessed directly. I've written a plugin that ...
0
votes
2answers
187 views

loop inside a loop : search for posts in the same category

Could someone tell me how i could make this work? i have a loop, and i would like to create another loop to find the other posts from the same category : but this does not work : <?php while ( ...
1
vote
1answer
97 views

Sort posts by most recently modified

Is there a way to list posts in the order in which they were modified? For example; A user posts 5 posts (#1 being the oldest and #5 being the newest), by default they would be listed with #5 being ...
0
votes
0answers
584 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
3answers
756 views

Add class to every other posts using get_posts

I am currently using this little loop to display a list of posts using the "events" custom post type <?php global $post; // required $args = array('post_type' => 'events'); ...
0
votes
1answer
217 views

Both a page loop and posts loop on the same page

I'm trying to get first the content of a single page (the one that is queried), and then in a small section below i want to display the title of my bloggposts as a "Latest News" section. The problem ...
0
votes
1answer
378 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' ...
4
votes
1answer
498 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
611 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". ...
1
vote
1answer
932 views

Adding Pagination on a Custom Author Page

i have created a custom author's page that list the title of their posts. but the problem is i can't get the pagination to work if it's beyond the set post per page value. i have used get_posts() to ...
0
votes
1answer
4k views

How to get The Loop working with $wpdb->get_results()

I am doing a rather complicated custom query on a blog's front page, and trying to show the results using The Loop as shown here: Displaying posts using a custom SELECT query The query filters posts ...
0
votes
4answers
3k views

Displaying multiple post types on home page

I've read several examples of how to do this but I still can't get it to work - each time I use get_posts() it seems to only keep and display the first set of results. loop.php function ...
4
votes
5answers
4k 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 ...
0
votes
1answer
185 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 ....