Tagged Questions
-1
votes
1answer
25 views
query posts in wordpress
I want to filter my query results just before the_loop starts in word press. I only want the results having term_id or term_taxonomy_id equal to 1.
...
0
votes
1answer
23 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>
...
2
votes
1answer
30 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 ...
0
votes
1answer
103 views
Using loop pagination on single.php
I want the main front-page loop to show in a section on both index.php AND single.php templates, with pagination.
Pagination works fine on the homepage, but not on single posts. This is the code ...
0
votes
1answer
57 views
How to break up php code to avoid echo
I have this php code I am using to list all post (titles) with the taxonomy categories names, and its working fine however I will like to break it up and avoid using echo within the php code so that I ...
1
vote
2answers
67 views
Query for posts in 2 taxonomies
I am currently using the following code to display a list with links to posts in a specific CPT and taxonomy:
<?php
$custom_terms = get_terms('videoscategory');
foreach(array($custom_terms as ...
0
votes
2answers
42 views
show posts from one category with comments only
Would anybody have a good idea for getting the WP to spit out all posts from a category with (approved) comments only?
I have an ecommerce site set up, and treat comments on product posts as ...
0
votes
1answer
38 views
How to order posts in an arbitrary order?
I need to list posts in a very specific order that has nothing to do with the date of the posts or the title, or anything WordPress can figure out for me. I need this order to be used when I list ...
0
votes
1answer
22 views
Custom Post type showing up in loop, regular posts are not showing up
Every one knows the basic WordPress loop, every one knows that if you want just posts in a loop you put query_posts("post_type=post"); BEFORE the loop. which I have done.
The problem is I have a ...
1
vote
1answer
220 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
176 views
Pagination on category.php and tag.php not working
i'm using a query-loop on my template pages like this:
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$wp_query = new WP_Query();
...
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
207 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
67 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 ...
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 ...
0
votes
1answer
82 views
Performance concerns: index.php vs taxonomy-$taxonomy.php
On one of our latest projects I'm planning to use the index.php file to display different taxonomy layouts. Basically I'm planning to use is_tax( 'sometaxonomy' ) to display the data/loop for ...
0
votes
1answer
98 views
How to get posts published on the latest date?
Is there a way of getting all posts published on the latest date? It might not necessarily be today, it might be yesterday or the day before yesterday or even a day last week.
0
votes
1answer
158 views
Using WP_Query and Query_post for the loop?
I am using the code below to call post from a certain Taxonomy term. My intentions are to mix that into the normal loop.
I'm am not trying to create two different loops, but one loop that displays ...
0
votes
2answers
131 views
Display all posts from specific categories on a page
I want to display all posts from specific categories on a single page.
Therefore I edited the page.php file in my theme folder.
I added an 'if-clause' to check which page currently being displayed and ...
0
votes
2answers
98 views
Multiple loop for “featured” items returns wrong posts
I have a page template where I first am getting the contents of the page, as input in the admin tool, then a loop of posts of a custom post type.
I need to split this loop up into the 2 newest posts ...
0
votes
0answers
93 views
WP Query -> is_category Error? [closed]
I'm getting the error
Fatal error: Call to a member function is_category() on a non-object in /home/dev/public_html/wp-content/themes/wt/sidebar.php on line 52 for the code below
<?php if ( ...
1
vote
2answers
140 views
Query Posts Exclude Entire Category
I am using the standard wordpress loop that looks like:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h2><?php the_title(); ?></h2>
...
0
votes
2answers
70 views
Determine if ID is page or post and query the ID
I want to look up a page id and determine if it's a page or post. Then query that id and display stuff like title, featured image, etc.
This works for Pages:
query_posts('page=' . ...
0
votes
1answer
130 views
Problem with different query loops (and “main loop”) on category template page!
so, heres the problem:
i've created a category-template (category.php) with two query loops and the main loop (in which the content from the category should get looped in). if i now click on a ...
1
vote
1answer
109 views
Order posts by ID in the given order
In the back-office of my theme, the users can choose which posts to display in the front page, and they can also choose in which order the selected posts should appear.
I have tried like this:
...
0
votes
1answer
344 views
Custom template for password protected page
I have a password-protected page, for whom I'd like to use a custom template to query posts from a specific category. How can I achieve that query_posts should work only after users submit the ...
4
votes
2answers
404 views
Build a content and excerpt grid loop with paging and options for # of posts
What I'd like to do: on index.php, a loop that shows a selectable number of full posts using the_content and then below that shows a selectable number (the number of posts can be hardcoded in the ...
0
votes
1answer
133 views
How do I rewrite this loop as a new WP_Query style-loop?
How do I rewrite the if (have_posts()) : ... while (have_posts()) : the_post(); style Wordpress loop below as a new_query style-loop using <?php $the_query = new WP_Query();? ( As shown in ...
1
vote
1answer
145 views
Listing all term items alphabetically / sorting loop
I have my own custom post type and it has its own taxonomy and terms.
Whenever user visits http://example.com/mytaxonomy/myterm I want the page to display all items within this term alphabetically.
...
-1
votes
1answer
179 views
How to exclude certain portfolios from a loop
I am new to the site and have racking my brain on a Wordpress issue for days. Hope you the intelligent people here can help me figure this out.
I have a page on my website that displays all my ...
0
votes
1answer
74 views
Filtering posts by WORD in custom field
I need to filter my posts in categories pages, by showing only posts that have specific WORD in custom field value. I need php code that i should add in loop for this category.
Details:
I need loop ...
0
votes
1answer
628 views
Display one latest post from multiple categories
This should be very easy, however for some reason I can't find a working snippet anywhere on the web..
I basically need to display one latest post from 6 categories (can be changed to 7,8, etc etc)
...
0
votes
2answers
211 views
Multiple posts with one loop iteration
I want 3 post with one loop iteration, so I'm using the_post() to achieve this: (html removed)
<?php while ( have_posts() ) : the_post();
the_title();
the_post();
the_title();
...
2
votes
1answer
714 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
1answer
198 views
Pagination not working in category listing
I can't get pagination inside categories listings to work.
I'm using a custom query, with the get_query_var('paged'):
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args=array(
...
0
votes
2answers
187 views
How can I improve the performance of this query_posts loop?
I created a WordPress page template to build a customised XML feed for certain WordPress posts on my site. Specifically, the page template renders XML and only includes certain custom post types and ...
1
vote
0answers
82 views
Order by category titles
I have a category page called 'features' this is all fine, but the posts in the features category also belong to a certain genre of film, and it's this what I want to order the posts by on the actual ...
0
votes
2answers
90 views
Least Number of Loops to Create Custom Homepage?
I am trying to create a custom homepage where the site content is shown as follows...
See image...
http://i.stack.imgur.com/ykrdf.png
With separate loops this is simple... 3 individual query_posts ...
1
vote
2answers
703 views
Order posts by custom field and if custom field is empty return remaining posts
I have an archive page ordered by a numeric value in a custom field. This returns the ordered posts correctly, but does not display posts that don't have a custom field.
$paged = ...
0
votes
1answer
433 views
How to Loop within a Loop (Display Children and then Grandchildren)
I am trying to develop a query for WordPress that will allow me to display a list of child pages with titles only, and then under each child page title, a list of grandchilden (children of the child) ...
0
votes
2answers
1k views
Exclude current post ID from loop in sidepbar.php
Currently all the below bit of code is doing is showing 3 random posts from the same category that the current page resides in. So if the current page falls in the artists category, for example, show ...
1
vote
2answers
107 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 ...
1
vote
1answer
179 views
Displaying terms based on loop posts?
I have a shortcode that shows a loop for a custom post type:
while ( $loop->have_posts() ) : $loop->the_post();
// do something
endwhile;
Some of the posts are in categories ...
0
votes
2answers
170 views
How to only publish posts with image in it
I use a standard loop in my index.php and that shows all the posts beeing posted. What i'm looking for is a code that only shows the posts that have image(s) in it.
With other words: i only want to ...
0
votes
1answer
2k views
How to get posts published between a date and today?
Is it a way to get posts published between a date and today with query_posts() ?
Example : All posts published since 2012-04-01
Thanks
EDIT :
How to add the filter date on this Query Posts ?
...
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 ...
0
votes
2answers
954 views
How to create custom query by keyword in post title?
I need some help regarding Custom Query by keyword.
I send a keyword to my page where I would like to list those posts which post_title contains the keyword I sent.
Here comes my query as follows:
...
0
votes
1answer
149 views
Modify loop but keep the original query, what am I doing wrong?
I have a custom post type where I have a taxonomy cities and a term berlin. Archive can be seen at example.com/cities/berlin and it's rendered normally from the archive.php template.
Now, I want to ...
3
votes
1answer
127 views
How should I intercept the main query and inject custom join / order by / group by criteria
I have a CPT that is a member of two separate taxonomies. On the taxonomy archive page for one of the taxonomies, I need to further group and sort on the second taxonomy like so:
...
1
vote
1answer
840 views
pagination not working for category.php (custom post types in categories)
it works everywhere on my site but it isnt working in category.php. When i click page to it goes to... domain.com/category/cat-slug/page/2
by the way this is showing custom post types within certain ...
