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
73 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
70 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
1answer
265 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
252 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
182 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
54 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
146 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
102 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
66 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
147 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
81 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
97 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
73 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
108 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
84 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
750 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
61 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
26 views
Paginate pages with dynamic query
I have a wordpress page that has a series of listings and a searchbox at the top. The search allows the user to filter posts by creating a custom WP_Query object based on what they selected. I am ...
0
votes
1answer
20 views
How to inject a post within a loop
I'm trying to inject a post while the loop is running.
This post will be injected on a condition, so
if(x == j){
//inject post here
}
I see this would seem easy to do, but i have a posts_per_page ...
0
votes
1answer
50 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
50 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
246 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
158 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
30 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 ...
2
votes
0answers
817 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
162 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
80 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
140 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
185 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
136 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
189 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
160 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
85 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
16 views
How to get post titles starting with numbers and symbols?
I want to get all posts which are starting with a number (0-9) or symbols, in a list. I managed to get it work for letters, but this one is harder for me. Can someone help me out please?
I tried ...
0
votes
0answers
21 views
WP Build-In Post selector for CPT
I'm quite sure to remember any WP build-in function that generates post selector based on several args (post_type, etc.) like on the nav-menus admin page, here a screenshot:
Is there something like ...
0
votes
0answers
32 views
Advanced Custom Fields Post Object
I am looking to create a custom proposal system with WP and ACF. I created 3 custom post types.
Proposal Objectives
Proposal Items
Proposals
I created some custom fields in ACF to include in ...
0
votes
0answers
28 views
Turning wp list categories into a dropdown menu
I am creating a custom dropdown for my wp site and I am running into issues.
I have a taxonomy set up called 'types', these can be filtered in a nav at the top of the page and they link to the right ...
0
votes
0answers
29 views
Listing Subcategories with post titles underneath
When viewing a parent category page, I am trying to list its sub-categories with each post title (max 5) underneath. I have managed to put together a code that lists sub category titles and I have ...
0
votes
0answers
25 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
64 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
22 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
28 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
27 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
30 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
78 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
30 views
query_posts with particular custom field
I have posts in categories with id 32 & 36. Sure I can get all those posts using
query_posts('cat=32,36');
But few of the posts in both categories have a custom field called is_featured with ...
