The core of the WordPress query, the loop offers an easy way to access post information and display it on your website.
0
votes
1answer
10 views
display post thumbnail for specific category outside of loop
I'm building a theme that features a section wherein I'd like to have the single most recent post's thumbnail of a single category displayed between the header and blog sections. Something like ...
0
votes
1answer
20 views
wordpress taxonomy results
I am using taxonomy.php to fetch some rows from database. On taxonomy page the function get_queried_object() shows that I have got the right results from database but wordpress loop if ( have_posts() ...
0
votes
1answer
411 views
A two column loop with one lead post
I got a loop from internet (I forgot the site) for two column post view. It has a nice CSS for it too. But skipping that for the question now.
<?php $counter = 1; ?>
<?php ...
0
votes
1answer
8 views
Pull Instagram images into an existing loop?
I am looking for a solution to pull Instagram images (from a single account) into a Wordpress loop and mix them chronologically with standard posts that will have been created within the Wordpress ...
0
votes
1answer
21 views
Control content before and after custom post type loop
I am trying to create a left nav menu that contains a couple of different taxonomy lists of a custom post type. For example, the left menu might look like this...
<h2>New Stuff</h2>
...
0
votes
1answer
14 views
List post only under the category, exclude child category content
I wanted to list posts which are directly under a category and not inside the "sub category". In other words, I want to hide all the posts which are from "Sub Category" in the Parent category view.
...
0
votes
2answers
40 views
PHP if post is already displayed, then
I have created a new page with a jquery carousel which rotates between various different news topics. You can see here:
However below the carousel is a static list of additional headlines. What I ...
0
votes
0answers
28 views
Advise on Templates for Custom Queries
I'm trying to figure out the best way to solve this problem. I have a couple of archive type pages that display content from multiple post types at once. For example, I've overridden the default ...
0
votes
1answer
28 views
WooCommerce checkout gateway creating redirect loop
I have set up PayPal as my payment gateway for WooCommerce, do not have an SSL certificate, and am not forcing SSL. Checkout and payment are set to go to the checkout page. When I try to test the ...
0
votes
3answers
51 views
is_home, and is_front_page conditional problem
I have this snippet in a "portfolio-loop.php" file. I'm using get_template_part to display the loop on the front page and on other pages.
I have this within the loop:
<?php if( !is_home() || ...
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
34 views
Identify the page being shown while in The Loop
In my loop, I'm trying to set it so that certain text is displayed on certain pages, if there are no posts to display.
I thought this would be simple, using is_post(), but it seems that this function ...
0
votes
2answers
139 views
How to group the loop posts in a particular by author?
I have links going to category pages on a WordPress blog. These category pages show all the posts that are in that category and sub-categories. I want to group these lists by the authors.
I guess ...
0
votes
1answer
129 views
Converting multiple loops into one single loop with pagination
I am using Isotope jquery plugin to filter/sort posts in Wordpress but to correctly filter the posts into the right order I have needed to output each category one after the other. To do this I've ...
0
votes
1answer
17 views
My custom query not detecting the correct category
For category.php my custom query code isn't displaying the posts from the correct category.
I have a parent category called 'Blog' and it can have any number of unknown children. With that in mind ...
0
votes
2answers
43 views
Interrogate a page within a loop to check template type or custom meta data (Pages vs Posts)
I've spent a few days researching working with WP static pages - as separate from posts.
Although I've found useful guidance, I can't seem to find any good tutorials or worked examples that show me ...
0
votes
2answers
22 views
Showing related posts (custom post type) outside of the loop
I'm trying the following (it's a sidebar widget in the Single New template):
<ul class="featured-jobs">
<?php
$postid = $post->ID;
$categories = ...
0
votes
2answers
24 views
How to display first post
I want to display in the front page of my theme the first most recent post in the header and then continuing the loop in the main content section starting from the second to post and so on, how can i ...
2
votes
1answer
27 views
Can't show comments count per post outside loop
How can I show the amount of a comment per post outside the loop? I tried this in a function already:
' . get_comments_number . ' , but that outputted the text "array" on the screen... What do I have ...
1
vote
2answers
105 views
Query last updated posts (posts updated in the last 24 hours)
I'm having some difficulty to find an example of how to create a loop with posts that had been updated in the last 24 hours.
My idea is to have a page of posts or perhaps on the index.php a lists of ...
0
votes
1answer
23 views
Looping taxonomy in taxonomy?
So I have a CPT of references (like a dictionary kind of format for music).
In it there are two taxonomies: medium_reference and reference_letter.
The reference_letter lists letters A-Z, while ...
-3
votes
2answers
31 views
How can you make it so the comment box shows on some pages or posts but not all?
Pseudo code might look like:
if it's this type of post
display comments and comment box
otherwise
forget it
This same type of code should also allow someone to have HTTP requests if it's ...
-1
votes
1answer
34 views
Trying to display posts but getting the pages as output
I am trying to display the posts on my front page of the roots theme's base.php file.
I have added the loop as
<?php while (have_posts()) : the_post(); ?>
<?php
echo ...
1
vote
1answer
313 views
Facebook “like” open graph meta in header.php
I would like to add open graph meta tags to my header.php, but can someone explain how this works if header.php comes before my loop with the relevant information??
<meta property="og:title" ...
0
votes
1answer
172 views
Open Graph in Index Loop
I have an index of posts where I'm wanting to insert a Facebook Like button for each post. Thus far, I've set all Open Graph data in the head for single posts. Any ideas on using the open graph data ...
0
votes
1answer
79 views
Pagination not working on home page
I've a page named "share" with a complex loop that's working perfectly. This page is located at domain.com/share. Now I need to use this page as the home page, so I went to "Settings -> Reading" and ...
1
vote
2answers
412 views
Why do next pages load the same content rather then older articles?
For some reason, the 'previous posts' and 'next posts' on the homepage do not load previous posts, but rather the same posts that were on the main page.
Why is that? I don't even know where to start ...
0
votes
1answer
18 views
Category archive is displaying all posts rather than the specific category
Here is my loop code for index.php . I do not have an archive or category.php right now. This is very basic.
$temp = $wp_query;
global $wp_query;
$wp_query = new WP_Query();
...
0
votes
1answer
30 views
Custom search form to display users only
I'm trying to build a custom search form for one of my pages. I need the search form to be able to search for users. Not only will it need to search for users, but by first name, last name etc.. ...
0
votes
1answer
24 views
For Each +1 Wordpress Loop
Im using a loop to make a slider. My code is
<?php
query_posts( array( 'post_type' => 'my_gallery', 'author'=>$author->ID ) );
while( have_posts() ) :
the_post();
$imagethum = ...
0
votes
2answers
2k views
Loop not allowing infinite scroll after post per page limit
Im using masonry with infinite scroll to display posts in a loop. I set the post per page which works great on the index page but when I place that same loop on a single page or a buddypress profile ...
0
votes
2answers
31 views
“Right Way” to make custom Loop respect reading settings inside admin panel?
I have created custom Wordpress loop using WP_Query, loop is working fine and I can customize it nicely, however i have a problem using "Blog pages show at most" settings, for example inside my loop ...
2
votes
2answers
293 views
How to order results by date and meta key?
I'm using wp-postratings to rate posts which stores the rating as a custom meta value ratings_score. It gives you the option to use r_sortby to order the loop by highest rated but I want to give it a ...
-1
votes
2answers
27 views
Why don't some template tags work when querying information on single.php?
I'm trying to fetch content about the current post into the header.php of my theme (to dynamically insert Facebook OpenGraph Metadata).
Since I'm on a single post page, shouldn't it be able to run ...
0
votes
1answer
32 views
the_content not working on one of two Multisite sites
I have a multisite with two subsites (sub-domain setup)
both sites have the same theme, same plugins but the first one is in Hebrew and the Second in English.
On certain templates (not all) in the ...
0
votes
0answers
19 views
Run a query when in last category
Can anyone help? ive searched google but with no luck.
currently Accounts has sub categories but no posts
/accounts/ = /billing1/ + /finance/
Billing and finance have posts but don't want ...
5
votes
3answers
268 views
Get 'page' number with infinite scroll
I added infinite scroll support of the Jetpack plugin to my own theme using this tutorial:
add_theme_support( 'infinite-scroll', array(
'container' => 'content',
'footer' => false,
...
1
vote
1answer
24 views
Reverse chronology of post listing
I"m working on modifying a theme that is based on 2010.
I want to make the posts on this blog display earliest to oldest, but I don't see how to do this in the theme:
I understand I need to add . ...
2
votes
3answers
468 views
Wordpress query by category, sorted by custom field
I have three custom fields set for each of the posts in the events category — year, month, and day. I am already querying for the events category, and now I'd like to sort the posts by the custom ...
0
votes
1answer
236 views
WPML wp_query not working properly in one language
I have a wp_query for a custom post type and the custom taxonomy, the idea is top display the term name and below each term the associated posts. I have two languages Dutch & French. Query is ...
3
votes
1answer
253 views
Creating nested forum loops in bbPress
I'm creating a customised forums front page for bbPress, by listing forums in a different way to the bbPress default.
Essentially what I'm trying to do is replace the use of bbp_list_forums() with a ...
0
votes
1answer
125 views
wpdb inside foreach loop only returns first result - 2 other similar cases found
@Milo Problem solved, found spaces in the array $arrname.
I was trying to get post id using post_name. First of all I stored all post_name in an array an then loop through the array to use the key ...
1
vote
2answers
64 views
Output 2 items within the Loop
I have a query that loops through <li>'s and displays the number of <li>'s I have. Is there a way I can make the loop pull 2 <li>'s at a time rather than one?
// 5 list items
...
-4
votes
2answers
44 views
How can I display sticky posts at first in wp_query?
I'm looking for a long time, but I could not find a solution. I'm not a coder. Please help me. Here is my wp_query code;
$my_query = new WP_Query('category_name=animals&showposts=10');
while ...
-2
votes
2answers
239 views
How do I remove blog entries from home page Twenty Eleven child theme?
I have been wrestling with this for some time. I've read the documentation about creating a separate home page and posts page, and so on, and I have managed to create a landing page, and a blog.
...
0
votes
1answer
116 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
39 views
Strip <p> from <blockquote> or something better?
Looking for some help on something that has me really contemplating not using blockquotes for the moment!
I have this code:
<?php
$show_after_p = 1; $content = apply_filters( 'the_content', ...
0
votes
1answer
39 views
Get User_id outside wordpress,
i am trying to get the User_ID outside of wordpress. I have a rating plugin and it needs the current user id, to cast votes.
However it seems that something is going wrong.
This is the part of the ...
-1
votes
0answers
29 views
Display Child Pages, title and excerpt on to homepage
I would like to do something like shown below, but don't know the proper code. I basically want to pull the title and excerpt of child pages and display it on the homepage. I want to be able to list ...
0
votes
1answer
29 views
Why is my category post repeating twice
Im trying to output category with its post on a single page, but for some reason the post from all category are repeating in each category, what am i doing wrong here
Here the code:
<?php
...
