0
votes
1answer
55 views

Query posts from a specific category and selected tag

I am trying to have a page (tag page) with this conditions: query posts from a specific category (for example : products) show only the posts with a selected tag (the tag is variable) not all the ...
-1
votes
1answer
8 views

The page that displays Posts on homepage

I want to know the page responsible for displaying the blog posts in WordPress. Where I can probably expect to find the SQL query and post rendering so I can edit some stuff by myself.
0
votes
1answer
23 views

Continuous listing from a custom field

I have posts with custom fields called "cb_vote_nb_vote" which holds the vote count for every post, what I want to do is let's say posts under A category will be listed based on vote count, I do that ...
2
votes
1answer
82 views

How can I display a specific user's first published post?

I'm looking for a way to display a user's first published post using their unique ID. I have a function that calls a list of specific users using their IDs, and would like to display the date the ...
0
votes
1answer
23 views

Query Only Show Text on Posts With Certain Taxonomy Tag

I am trying to query in a post to show a fixed line of text at the end, so that if that post has a specific taxonomy tag applied to it (Special), then a line of text will show. I guess it's something ...
1
vote
1answer
25 views

How can I setup a relationship using categories in WordPress?

I am trying to setup a relationship between a "People" post type and a "Work" post type. For example, I want to have a structure like this Person 1 - Work - Work 1 - Work 2 Person 2 - Work ...
1
vote
1answer
68 views

Should 'setup_postdata()' be reset with 'wp_reset_postdata()'?

Starting with an example makes more sense, so here's an example function: function seo_meta_tags() { global $post; if( is_singular() ) { setup_postdata( $post ); ...
1
vote
1answer
51 views

Only display a certain number of posts, dependent on how many posts there are available in a query

I am trying to write some code for a slider of posts, at the moment my code involves two WP_Querys, one inside the other, but I can't help feeling there may be a more efficient way of doing what I'm ...
0
votes
0answers
43 views

query custom post type by date

I created a custom post type envent. I d like to filter out post in the futere. I did use the advanced custom fields plugin to make a date picker. I used following code, but somehow id does not filter ...
0
votes
0answers
167 views

Query Posts From Multiple Post Types

Is there an easier or more efficient way of querying posts from multiple post types by the date of which they were published? I read this question here: Using Query Posts With Multiple Post Types And ...
0
votes
2answers
149 views

Should $found_posts be returned as string in 'found_posts' filter hook?

In general a function that hooks into the found_posts filter looks like this: add_filter( 'found_posts', 'adjust_offset_pagination', 10, 2 ); function adjust_offset_pagination( $found_posts, $query ) ...
1
vote
2answers
33 views

Exclude the first 'n' number of posts of a tag from home page?

Use case (example): Using a separate, custom query my website's home page shows 5 featured posts, tagged 'Highlights (highlights)', followed by the latest posts, from the main query. I don't want the ...
0
votes
0answers
63 views

Sort post by category using HTML Select tag

Good day wordpress dev. Just want to ask if it is possible to sort, filter or query post using HTML Select tag? This is the design I am trying to develop. ...
0
votes
1answer
101 views

How to store post rating system data post independent?

There's code below for simple post rating system (tutorial from this site TUTORIAL ) - it works fine but i need to change it a bit. Now where user votes, he is not able to vote again for same post for ...
1
vote
2answers
170 views

Sticky post appears twice

I am trying to modify the number of posts_per_page in the loop. This way: function posts_per_page($query) { $query->query_vars['posts_per_page'] = 3; } add_filter('pre_get_posts', ...
0
votes
1answer
153 views

do_shortcode within post query

I am querying blog posts with a specific category (according to the template page slug, and want each post to output a slider, title and content. I'm using the wordpress plugin Anythingslider for ...
0
votes
3answers
245 views

Dynamically switch template on click

I have a custom post type setup with a couple custom fields. I am creating a page where I display all of the custom post types, except I want to have multiple views. See the examples below. One is a ...
0
votes
1answer
156 views

Random Category with Recent Post Title and Thumbnail

This code below works perfect to pull the title of five random categories, the issue is for each random category I want the latest post title and thumbnail but where and how do I add the post query? ...
0
votes
3answers
445 views

how to get a different html for odd/even posts?

query posts if posts exist then begin the loop if post is even: <h1>title</h1><p>content</p> if post is odd: <div>its ...
0
votes
2answers
1k views

Using $wpdb to query posts with meta value containing current post_id

I am trying to to use $wpdb to retrieve a list of posts from the Database where the meta_value in the wp_postmeta table contains the current post_ID in inverted commas. eg. "10" The inverted commas ...
0
votes
2answers
70 views

How to get posts and comments amount per hour, per year and per month?

I have this snippet: function count_user_comments_today( $uid ){ global $wpdb; $today = date('Y-m-d'); $tomorrow = date('Y-m-d', time() + 86400); $count = $wpdb->get_var( ...
0
votes
2answers
158 views

Get first comment link on the post itself

I have this function and a link to a post: <?php foreach ($results as $id) { $post = &get_post( $id->ID ); setup_postdata($post); <li><a <?php href="<?php ...
0
votes
1answer
54 views

Can't get full post title if there a spaces in title

I want to make a custom query that checks the post title and puts in a different URL like this: <a href=bing.com/search?q=<?php echo single_post_title(); ?>>Blablabla</a> But it ...
0
votes
0answers
59 views

WP_Query retrieve custom posts but not the post showing

I am developing a custom post type which shows releated posts which are within the category which is working perfect but I cant seem to get the right query to make it not show the current post which ...
0
votes
3answers
84 views

How to get all post_parents of a post?

Unfortunately, $post->post_parent is a single variable and not an array. I want to get all post_parents of a post (especially of an attachment, which is often linked to multiple posts!).
0
votes
2answers
18 views

How to have more post in a page than in your home page

I am new to the world of WordPress. I own a new site and I'd like my home page to display the latest news and articles (which I accomplished to set in Settings > Reading), but I'd like another page to ...
1
vote
1answer
29 views

How Can I Query a Specific Page From a MultiPage paginated Post

Let's say I have a post that has been paginated by adding the <!-- nextpage --> code provided by wordpress for this purpose. How can I then query a specific page from inside of that post. ...
0
votes
1answer
59 views

Post content stays the same but permalink changes ?

This is really weird. I made a posttype ' mediagallery ' via the plugin Types fields. I simply want to load the post content and switch the posts with a next & prev button in de sidebar. The post ...
0
votes
2answers
435 views

How to display only one category in a custom post type?

I have a custom post type called 'portcat' and I want to display the results of only one portcat category ('games' - which has an ID of '3') on my page. The below code displays all of the categories ...
0
votes
0answers
112 views

Special Query: Title, Terms, Content - %LIKE%

I'm working on a them theme that is search-heavy, and my users are putting huge priority on an improved search function. I think I will have to use a special direct query to search these things: ...
-1
votes
1answer
86 views

query_post or single-[cpt].php?

php query_posts( 'post_type=listing'); Or single-listing.php? According to my reading I have presumed that to display a custom post type all I need to do is copy my single.php and rename it ...
0
votes
1answer
69 views

Query for first 3 posts to change the look and feel

Is there a way to query for the first three recent posts and then change how they display on the front page? I want the first three posts of my blog to show differently than the rest of them i.e. ...
0
votes
1answer
249 views

Query posts from current year

I don't quite get why this isn't working. I'm trying to use the following to only show posts from the current year on the front page: <?php query_posts( "&year=$current_year&order=DESC"); ...
0
votes
1answer
50 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 ...
0
votes
2answers
207 views

Get all custom post types excepted some…

I stack since a few hours now and I'm sure that this is not so complicated. I would like to get all custom post types into this $posts = query_posts( ...
0
votes
1answer
54 views

Make division in post_query?

I am new to both PHP and WP so I am struggling with one thing: I want to fetch all my post and then order it according to my meta-value "_mycounter" divided with the date in seconds from 1970 or what ...
0
votes
1answer
124 views

How to limit post query to only return a total count of items with certain post statuses?

I have a couple functions that are creating an admin table to display on my custom dashboard page. I'm having a little trouble with the function that determines what pages to display because I'm not ...
0
votes
1answer
179 views

Why posts array is empty?

I try to get posts that either do not have a custom field set or if set have a value not like a given parameter. Here is my code: $args_included = array( 'numberposts' => 1, ...
1
vote
1answer
135 views

Query posts from different categories in multisite

In my planed multisite installation, I want the members to be able to post in one of two different categories. Members in A can post in 1. Members from B can post in 2. All members can comment ...
0
votes
1answer
1k views

posts_per_page doesnt work

Here is the my custom query ; <?php $Poz = new WP_Query(array( 'posts_per_page' => 3, 'orderby' => 'date', ...
0
votes
1answer
185 views

Adjust the order for returned posts

I have written a neat responsive slider for my Wordpress featured articles (feel free to use it): <?php $responsive = 'on' != get_option('henrik_responsive_layout') ? false : true; ...
0
votes
1answer
275 views

Export all posts to import as product items

Up until now, my client has been using WordPress posts as his way to display his products. I now need to export all these posts into a CSV format so that I can format the CSV file and import it back ...
1
vote
1answer
77 views

Most liked page not displaying posts

I was looking for a post rating system for a while, then I stumbled across a great tutorial: http://wp.tutsplus.com/tutorials/how-to-create-a-simple-post-rating-system-with-wordpress-and-jquery/ I ...
1
vote
1answer
135 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 ...
0
votes
2answers
270 views

Duplicate posts

I'm currently working on a Magazine style website and on the main page I have three different sections where I display the latest news. Slider, latest news and more news. The problem is I can't ...
0
votes
2answers
148 views

get last post's link with SQL query

I have installed a WP on website A and I want the last post's links in site B. I haven't in site B any WP and I want to get the link of last post from website A. so I can't use WP API like WP_Query ...
2
votes
1answer
268 views

How can I get all posts data from within a paginated search result?

Let's say I'm doing a search on my site, and get 50 posts as a result. The pagination is set to 10 posts per page, so I have 5 pages of results. When I'm on the first page of results, if I inspect ...
1
vote
1answer
744 views

Query get post,how to add comment box

Hello I have a query that gets a post with id=x and it works but it leaves out the comment box. Is there a way to add "get comment box" to the query? <?php $post_id = 104; $queried_post = ...
0
votes
1answer
238 views

Query posts and filter at query time by value of custom meta

I have a wordpress query for a custom post type, but I want to filter the results depending on the value of a custom meta. <?php $my_query = new ...
0
votes
1answer
549 views

Trying to put an array into 'post__in' => array() query not working

Slight problem, I have the following code: $purchaseprodid = $_GET['ids']; $args = array( 'post_type' => 'prizes', 'post__in' => array($purchaseprodid) ...