The core of the WordPress query, the loop offers an easy way to access post information and display it on your website.
2
votes
2answers
78 views
Do I need to use The Loop on pages?
I'm writing my first WordPress theme and have a question about the use of The Loop in page templates. The page templates I've looked at all follow basically the same pattern (example from Twenty ...
0
votes
3answers
44 views
Trying to display ads on only a third of posts in a loop. Keep getting Error 500?
I'm thinking it's just a PHP code error, but for some reason the following code won't work, it just keeps giving me Internal Server Error 500
<?php
$ajfl_adLuck = rand(1,3);
if ($ajfl_adLuck ...
1
vote
2answers
65 views
Query reset problem or flawed code to enable custom post type query
After reading through here and trying various options, I am finally able to get my custom post types 'testimonial' (created with product 'Toolset') to show along with my standard cat/tag queries ...
0
votes
1answer
27 views
Hook to main query with filters based on custom fields
I would like to do a filter that will hook to the main query and filter all the posts by some given taxonomy terms or custom fields. For now I have made the custom filters for the $query to only ...
2
votes
1answer
229 views
Pagination with custom post types results in 404 issues
I've a very simple index.php:
<div id="content">
<? get_template_part('content', get_post_format()) ?>
</div>
<div id="pagination">
<? previous_posts_link() ?>
...
1
vote
3answers
53 views
wordpress loop for specific category
i have this snippet for specific category it works perfect
but i want little modification to show posts by Ascending order.
<?php
// The Query
query_posts( array ( 'category_name' => 'A', ...
1
vote
3answers
239 views
Recent posts on a static home page
I want a static home page on my wordpress website, I have already set this up and have a bit of content on it, the next step is I want to have 5 recent posts underneath the content. As a normal page ...
1
vote
1answer
130 views
How to display 7 most recent days of posts?
I would like to be able to display on my homepage a timeline of posts from 7 of the most recent days. For example, if today is January 1, 2013, I would like my blog feed to display something that ...
0
votes
1answer
504 views
Loop through multiple custom taxonomy terms and display posts for a custom post type
I am working with custom post types in the bones theme from themble. There, I want to create a link list and therefor i've created a custom post type, called links.
This custom post type has a custom ...
0
votes
1answer
38 views
single.php fires more than once after clicking on any post to view with different post id each time
I am now experiencing a wired problem with my wordpress installation. I was surprised when I saw post view counter of another post also increased including the the post on which I clicked to try and ...
0
votes
1answer
199 views
Why WP_Query('showposts=5') shows only 1 post?
I am trying to do a simple query to get the latest 5 posts into an unordered list, but this is only showing 1 result even though I have several posts. I even did an offset, but it shows the next post ...
0
votes
1answer
73 views
how to run loop in function.php that sends email based on specific conditions?
So far this code works if I run it as a page in WordPress. I am trying to send my user email updates when I publish a post with with a specific tag. The users can choose if they want to receive the ...
0
votes
2answers
66 views
How to insert category list into post creation page, and retrieve chosen categories?
I would like to display the full list of categories on the Page creation page, so that the user can pick using checkboxes which category posts should appear on that page.
I then need to retrieve ...
0
votes
4answers
97 views
Alternate loop output every three posts (within the same original loop)
I have a (relatively) tricky situation where my code requires changing the loop output every three posts, and within those three posts there are divs around two of the posts.
The code below displays ...
2
votes
2answers
116 views
Rearranging posts based on categories
Hey everyone on Stackexchange!
I'm trying to find a way to prioritize posts based on a category in a loop, which is sorted by dates. All posts are grouped under their respective dates. The date ...
0
votes
2answers
61 views
Is the 404 page automatically displayed if a loop returns nothing?
If you have an index.php with a loop such as:
if(have_posts()){
while(have_posts()){
the_post();
}
}
And nothing is returned, you would generally do a:
if(have_posts()){
...
0
votes
1answer
59 views
Custom Meta Box If Else Statement
I have created a custom meta box for posts and I need to display said data. I have been using the below method to display the data, But I am in need of a slightly different solution.
<a ...
0
votes
1answer
53 views
Custom loop page with post navigation
I created a custom loop for a particular category. Can I create a list of those posts -- kind of like a table of contents -- and have it link to that service in that loop? Pagination is not used.
My ...
1
vote
1answer
80 views
Use WP_Query with have_posts()?
Is it possible to use
$items = new WP_Query( $query_args );
with
<?php if(have_posts()): ?>
<?php while (have_posts()) : the_post(); ?>
without changing the loop to be
<?php ...
0
votes
1answer
51 views
Loop being strainge
So I hacked together a function that does the following:
protected function _query_post($query){
$original = $this->_wp_query;
$wp_query = new WP_Query($query);
...
0
votes
3answers
87 views
wordpress simple loop, huge issues
Im having a problem where for some reason, a basic loop im trying to add to a sidebar keeps....keeps looping on interior pages (single and page .php ) but not on index.php.
on index.php (home page) ...
1
vote
1answer
137 views
How to filter posts that belong to a specific category only if that is the only category
I need to filter posts that belong to a category only if that is the only category. For example if my post A belongs to cat1 and I don't want to display posts that belong to cat1, post A won't be ...
-3
votes
1answer
47 views
$_html is empty when var dumped
So I have run across a bizzar issue, in which I know is working as i expect it to in terms of the array values, yet the _html variable returns something like string(29) " " which to my knowledge ...
0
votes
2answers
203 views
Change the way wordpress outputs images or image galleries
The title is the short version of the question.
Here's what I need in more details...
If the answer is not so simple, I would be glad if you can point me to the right direction with a tutorial or to ...
0
votes
1answer
29 views
Limiting the amount of posts retrieved by the loop
I'm using a theme which has its own homepage which is created using the theme options (i.e. so can't add content under Pages) so I'm trying to add the latest posts on the page, I have copied the code ...
0
votes
0answers
24 views
All posts not being displayed [closed]
I have built a site that uses the "posts" type to display their galleries as normal posts. It is set to be sorted by custa meta date and continue on down the page.
As of right now, I have made 15 ...
0
votes
1answer
47 views
Pages with a loop (index, archive) are loading the first image as post_thumbnail
Using post thumbnails for custom header images -- works fine on straight pages. But custom templates that load a loop (including index) are pulling the first image instead of using the one set in the ...
0
votes
1answer
85 views
new WP_Query all post in a category inside the loop
Im trying to get a list of post in a category with this:
$category = get_the_category();
$args = array(
'post_type' => array('post', 'entrevista'),
'cat' ...
-2
votes
1answer
88 views
how to use the values from print_r()? [closed]
I was trying to find a way on how to get the values from print_r(), I already typed-in the same scenario looking for the same problem and answers but only to find out answers that will only print the ...
0
votes
2answers
40 views
Plugin is creating posts twice
I have code which takes some $_POST data and loops through it. In the loop, I store the $_POST data in variables and create a new post using those variables. The loop ends when I run out of $_POST ...
0
votes
1answer
72 views
Only display latest custom taxonomy post
I have a custom taxonomy set as a "splash" on my front page, I would like to only display the latest one of these taxonomies as a splash, and any older ones to be returned to the loop and displayed as ...
0
votes
4answers
238 views
WP_Query and using a variable for 'cat'=> in the args array = WP Bug?
For the sake of this discussion, here's a version of my query within category.php:
wp_reset_query();
$category_id = get_cat_ID(single_cat_title('', false));
$my_query = new WP_Query(array(
...
0
votes
1answer
56 views
Using Query In Post Type Archives
I'm using the script below to call post from a certain category in the sidebar. It pulls from all post type on the homepage and on the single post page, but when it comes down to the post type archive ...
0
votes
1answer
66 views
Display 3 posts with different HTML markup using a loop
I want to be able to display 3 posts from the same category on my index.php page, but due to the way my site's HTML/CSS is coded I'm having some difficulty understanding the correct way to go about ...
0
votes
1answer
88 views
WP Query - duplicated posts once including tags in search results
I running WordPress on IIS & SQL server. As some of the plugins do not work correctly with DB ABSTRACTION I am using a lot of functions.php filters as so on.
To make my search results include ...
0
votes
1answer
102 views
Search.php - return number of results but cannot loop through
I have a following search.php page (this is just the code required for problem presentation).
Why is my $total_results returning a number of posts found, but when I do a loop though it always print ...
0
votes
1answer
42 views
Trying to get variables in hacked category dropdown
I've discovered a workaround to get wp_category_dropdown to display as a multiple select field. My code is as follows:
<?php
$sponsors = wp_dropdown_categories( array(
'child_of' => 0,
...
0
votes
1answer
118 views
How to Loop and add Specific Categories and Products Images into Specific Page Template?
Thanks to Rafael Marques I have a list of Products and Categories organized based on different created categories. I also have 5 different Custom Page Templates. Now I would like to display the ...
0
votes
2answers
105 views
Polldaddy doesn't show up on own theme
I'm developing my own theme on a website where I use the polldaddy polls & ratings plugin. I've set the ratings to show up on the homepage and that's working with e.g. the twentytwelve theme. ...
4
votes
3answers
66 views
Avoiding using a loop to access a single post
Sometimes I want to access one particular CPT to extract something from it, for example a custom field value:
$group = new WP_Query( array(
'post_type' => 'group',
'p' => $group_id
) ...
0
votes
1answer
79 views
Displaying child page content of a certain parent
What I would like to do is to create a WP loop that will display info from a child page of an adult page ID, so the Page ID is 2. I would like to pick a page ID to display what page.
So that way I ...
0
votes
1answer
43 views
get all page templates
I am working on a one page WordPress site. It's the first time I have tried this. I am on the fifth version with various degrees of success. I am starting a new version and I deleted everything in the ...
3
votes
1answer
87 views
Search widget breaks when using multiple loops?
I have created wordpress template that uses two loops via WP_Query object. Everything works fine except Search widget. I've been pulling my hairs out for three days now Googling like a madman,but ...
0
votes
0answers
71 views
display category_description in footer.php [closed]
I've created a slideshow as a "category chooser" on this website I'm working on. The code for this is in the footer. I now would like to display the category description also. But it doesnt' show up. ...
1
vote
0answers
75 views
Custom post type conditional in loop
I need multiple loops on a page and have created them as such
global $post;
$args = array( 'numberposts' => 3, 'category' => 10 );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : ...
0
votes
1answer
47 views
How can I access a post's feature image outside the loop?
I want to update my <meta property="og:image" content="http://amemoirproject.com/facebook/og-image.png"/> tag in the head with the current post's feature image. How can I do that?
0
votes
1answer
152 views
Custom Post Type Taxonomies -Posts not showing in Category or Tag pages
I have a made a custom post type called "Member Resources" the posts under this CPT have a few taxonomies such as categories and tags.
Tags = "Diversity"
Categories = "Guidance"
When I go to the ...
2
votes
2answers
89 views
single page site with subpages
i want to make a single page site which has subpages with following structure
about us
team
-member1
-member2
contact
and i want the output to be like
<div class="about-us">
team content
...
2
votes
1answer
57 views
Exclude category from loop not working
I have this code in my index.php file. I have a different template for a static home page, this is the blog page. I'm trying to exclude all posts with the category "new" which is tag_id "13"
<?php ...
3
votes
1answer
42 views
Wordpress “Loop” with large set of results
I'm not sure the appropriate terminology but I have a wordpress "loop" for a custom post type that has roughly 300 results that all get displayed on a single page (no paging). The causes an enormous ...


