Set up The Loop with query parameters. This will override the current WordPress Loop and shouldn’t be used more than once. This must not be used within the WordPress Loop.
3
votes
1answer
65 views
Using Offset in Custom Post Type Query
I'm using the following query for a custom post type:
<?php
$posts = get_posts(array(
'numberposts' => -1,
'offset' => 20,
...
2
votes
1answer
223 views
Using is_main_query to select custom post type on certain page
I've been trying to implement some of the ideas discussed by Andrew Nacin http://wordpress.tv/2012/06/15/andrew-nacin-wp_query/ into my workflow, specifically trying to move away from using ...
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 ...
2
votes
1answer
225 views
get_query_var('paged') always returns empty
Putting this up after having hit a brick wall for possible solutions.
Have a site with quite a few custom post types and associated custom taxonomies. To help make things easy, I'm using a unified ...
2
votes
1answer
35 views
How do I query for a post by custom field?
I have a custom field called "song-id" and I'd like to lookup a post by a song-id value. Can someone give me the code snippet for it?
(bonus: also looking for a code to use the permalink in the post ...
2
votes
1answer
173 views
Query posts: how to exclude results if post is in multiple categories
Say I have 3 categories: A, B, C, and another category D that posts in A,B,C can also be assigned to. D is to denote the featured post for the category, and theoretically only one post for each (A, ...
1
vote
1answer
45 views
Change order of posts
I made a post recently that did not explained myself right!
Come again, but with better explanations.
I need the "Select Option" change the order of query_posts.
My current code is:
<select>
...
1
vote
1answer
134 views
Getting movie and serial on actor page
I'm building a cinema site, I came with a problem, let me explain:
Movies- are stored in Post's
Actors- are stored in Post Type - persoane ( taxonomy= lista)
Serials - are stored in Post Type - ...
1
vote
1answer
85 views
How to use custom taxonomies to reference complex relationships?
I'm working on a site that will in part house information on products that many people have worked on in different roles. I'd like for people, the projects they've worked on, and their roles in the ...
1
vote
1answer
64 views
Schedule Sticky Posts
I'd like to display the most two recent published sticky posts by modifying the primary loop. A simple affair with the following loop.
However, if I schedule a sticky post to be published in the ...
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
vote
1answer
78 views
Query Page Content From Theme Options?
I'm trying to create a slider where you choose what pages are shown in the slider, using a theme options panel based on the https://github.com/vauvarin/options-framework-theme
That lists the pages in ...
1
vote
1answer
93 views
posts_per_page option limits the number of Gallery items
I have noticed that if I have a query where posts_per_page are set to 4, any (image) gallery that belongs to one of those posts will too have only 4 items (although when I create the gallery from Add ...
1
vote
1answer
72 views
Sorting a query Field by date
I have my site, which at the moment is display university open-days, at the moment they are sorting by order of page title, when actually I would prefer they sorted in order of date, soonest first, ...
1
vote
1answer
44 views
Hook to return true when the_post() is used in a custom while loop
I fetch external data like this, but I also added the_post();
while($slice = mysql_fetch_assoc($result)){
the_post();
rest of my stuff
}
I need a hook to tell me if the_post() returns true, ...
1
vote
1answer
105 views
Sort by page information by Ascending Numbers
Basically I have a problem that I have details being pulled from advanced custom fields and I currently have them ordered by page title in ascending order.
However, instead of ordering them Ascending ...
1
vote
1answer
79 views
Query posts by meta_key whose value is an array
Let's say I'm modifying the default posts query:
add_filter( 'pre_get_posts', 'my_filter' );
function my_filter( $query ) {
$query->set( 'meta_key', 'my_rating' );
$query->set( 'orderby', ...
1
vote
1answer
726 views
Loading post content in FancyBox
I got a tricky question. I have created a custom post type whose posts I would like to display in a scrolling carousel. The carousel will only display the title, the excerpt and a "read more" button. ...
1
vote
1answer
60 views
Have parent category contain only one post?
Projects <-contains basic info about projects
-Proj1 <-detailed info about proj1
-Proj2 <-detailed info about proj2
-Proj3 <-detailed info about proj3
I have a post attributed to the ...
1
vote
1answer
18 views
Trying to package posts for republishing by partner offsite
I'm wondering if someone may be able to point me in the direction of a tutorial that can help me deliver my last X posts in X category as a javascript snippet to a publishing partner.
I want to be ...
0
votes
1answer
34 views
How can I change the publish date based on a custom field?
How can I change the publish date based on a custom field?
Author uses a date picker to choose the date for journal entry. The date is used to make a list of all the users journal entries. I can ...
0
votes
1answer
32 views
How to get alphabetic listing x other posts, based on first letter post?
Let's say I have a post called "Hello World" and I am on that page... Let's say I have different posts like "Haaaa" and "Hoooo".... What I want to do is showing Haaa and Hooo in a different place (let ...
0
votes
1answer
238 views
Transfer taxonomy to custom field
I have a blog with movie critics and I'm using many taxonomies to add some informations about the movies, like director, actors or it's year. Using taxonomies is really useful to display all movies ...
0
votes
1answer
105 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
26 views
PHP dynamical conditional post display
I'm trying to get the WordPress loop to display only the post has an ID that reflects whatever $category_name is equal to, as shown in the line of code below. It ends up showing everything and not the ...
0
votes
1answer
79 views
Query specific posts per user selections from dropdown menus
This may be a little different than most people do. I'm trying to show certain posts that are determined by 4 different "categories." I have a large database table full of "products" (I'm using the WP ...
0
votes
1answer
96 views
Query Problem - Show posts within category 'x' that have a custom field between 'y' and 'z'
I'd like to display all posts within a given price range. For example: When a user inputs 100 and 1000 (in two separate form fields) - my site will display all posts that have a custom field called ...
0
votes
1answer
82 views
Search a title word through query_posts (not the exact match)
We're working on a database with personal data from different sportsmen such as name, height, weight, etc.
We've managed to build a detailed filter through query_posts.
Every filter field is working ...
0
votes
1answer
51 views
What's the best way to show custom post types? With page template it's not perfect!
I created a custom post type with name career. I would like to know what's the best way to list the posts. I created a page template with a query inside, but the pager is invisible. I don't know ...
0
votes
1answer
31 views
Creating pages and getting their values from the database table
I need to make inquries from my new website. I want to know whether Wordpress is capable of this:
Say it I have such a table:
CREATE TABLE IF NOT EXISTS `mytable` (
`id` int(11) NOT NULL ...
2
votes
0answers
36 views
How to implement time filter to show random post 1 month for one category and 3 months for other categories
I started to work on one website after another developer and there is problem with his "popular widget" which is basically showing 3 random posts from category. There is some Switch statement which is ...
2
votes
0answers
791 views
query_posts with a custom post type, a meta_query and sorting by post date?
I've searched the archives and found questions similar to what I need, but haven't found exactly what I want.
I've got a bunch of products that are sorted by a meta_key of country, and I'd like to be ...
1
vote
0answers
146 views
How to optimize 'select found_rows()' query? Several 'high load average' alerts daily
I have 5,000 regular posts, 6,000 posts in one post type and 2,000 posts in another post type. Needless to say, that has made the wp_posts table quite large. Not to mention, I have custom taxonomies ...
1
vote
0answers
79 views
How to increase load time of an archive/search page (WP_Query)
I'm currently looking at why the archive and search pages take so long to use, and have found that the bulk of processing time is spent on the query_posts that is called before the template has even ...
1
vote
0answers
24 views
Simple custom post query for all the posts or many of them not working
I am doing this query
$args = array(
'posts_per_page' => '-1',
'post_type' => 'custom_post_type',
'post_status' => 'publish'
);
query_posts( $args );
but it is not working
I have around ...
1
vote
0answers
137 views
Querying posts with meta value that begins with a certain pattern
I am trying to create a search filter using meta_query. The only problem I'm having now is that I can't compare with wildcards. I think that's how you word it?
$keyword = 'sos';
$tlds = ...
1
vote
0answers
181 views
List Posts For Terms Of A Custom Taxonomy For Any Post Type
The function is great and i am using this function with these filter to just display selected taxonomy term posts by id, but what result i am getting is like this
Child Taxonomy 1
- Child Taxonomy 1 ...
1
vote
0answers
129 views
define orderby URL with meta_key=post_views_count
I want to make an url with meta_key=post_views_count.
E.g: http://www.mysampleweb.com/?meta_key=post_views_count&orderby=meta_value&order=DESC
So the posts should be ordered by Views.
...
1
vote
0answers
187 views
filter custom field values $min $max
The user needs to query posts by entering a $minPrice, $maxPrice and a category value.
Here is my query which returns no results:
function result() {
$result = array(
'cat' => ...
1
vote
0answers
152 views
Query_posts and attachments
I need some guidance on some WP code. I'm wondering if it's possible to take this code (which is grabbing all the images from the posts across my site and dumping them out):
$args = array( ...
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
0answers
18 views
Display recent commented post above new submitted post
I have a list of all posts that are commented on a particular day. If someone comments a post, I want it to put that one above the other posts, even if they are submitted on a more recent date...
How ...
0
votes
0answers
22 views
Filter posts by multiple checkbox categories
I would like to set up a widget to filter my post by categories. Let's say, I do have two different categories, "Countries" and "length of stay" with sub categories. Here is an example of what I have:
...
0
votes
0answers
20 views
complete show post older 10 post
i want show random post older 10 post i used this code for show 5 random post
<?php
$args = array( 'numberposts' => 5, 'orderby' => 'rand' );
$rand_posts = get_posts( $args );
foreach( ...
0
votes
0answers
27 views
Displaying posts by year
I'm trying to display posts on the homepage from the current year only. I am using the following:
<?php if ( is_front_page()) { ?>
<?php $current_year = date('Y'); ?>
<?php ...
0
votes
0answers
23 views
Combining Custom Tax Conditionals and Custom Querys?
The following has a custom post type of features, within that a custom tax called feature-type with three categories, template-1, template-2 and template-3.
Each custom post feature needs to select ...
0
votes
0answers
29 views
Pagination for blocks with custom post_queries
I tried many of pagination functions but no one is working good. They all display page count and link to page but when I click on the link no result. Nothing is changed except browser's adress link.
...
0
votes
0answers
70 views
query_posts for all categories of an custom taxonomy
My custom taxonomy is
register_taxonomy( 'square_type', 'post', array( 'hierarchical' => true, 'label' => 'Square Categories', 'query_var' => true, 'rewrite' => true ) );
so, I ...
-1
votes
0answers
44 views
Isotope and query_posts
I'm experiencing an issue with Isotope jQuery and the Sampression theme.
I'm using a simple query_posts on my index page to view only one category.
It works fine at the first view, but when I click on ...
-2
votes
0answers
43 views
Get all posts starting with first two letters in Wordpress
I have a plugin in which an alphabetical list is posted where people can click on a letter and they get the posts with that letter. So if they click on A, they see all post titles starting with the ...
