-1
votes
1answer
17 views

List posts related to category on a div [on hold]

i want to display posts related to selected category at the same page(on a different div). What i want is as the image attached, when i click the category name on the left side, all related posts must ...
1
vote
2answers
70 views

Why won't my taxonomy query show up?

I'm attempting to display posts from a 'Uncategorized' category under a custom taxonomy called 'Reviews' but without much luck. I'm using get_template_part('loop','review') to call loop-review.php ...
0
votes
1answer
16 views

Remove duplicated posts in the loop if post has more then one categorie

I have some posts with more then one categorie. In the post loop i get the post based on the selected categorie by the user. If the user select 2 categories where one post is assigned to, the loop ...
0
votes
0answers
17 views

Only show top level posts of specific category

I've been trying to create a loop that will only show the top level posts no children/sub category posts. Basically what my categories look like are -- -All --one --- A --- B -- ...
1
vote
1answer
35 views

Get current post id in functions.php

I have a wp_localize_script() function in my functions.php where I need to push the current post ID of the current post to a jQuery file. So I was wondering how you can get the current post ID of a ...
1
vote
0answers
11 views

Posts 2 Posts: Get related posts from user connected to current post? [closed]

Hopefully someone can help with this. I have a CPT called "Tours", and I'm using Posts 2 Posts to connect Posts inside that CPT to Users. Relationships being: Tour Item 1 > Tour Operator 1 Tour ...
0
votes
1answer
37 views

Get first post from wp_query

How can I get the first post from a WP_Query result? $connected = new WP_Query( array( // Arguments )); // This doesn't work.. echo $connected[0]->post_name;
0
votes
1answer
42 views

Why does WP_Query show only the same post even with different categories and endwhile?

I have 3 divs that WP_Query with 3 different categories and end it with the php endwhile,but it only shows the same most recent post query three times over. Do I need to hard reset the query loop ...
-1
votes
1answer
48 views

posts_per_page - Repeats only first posts 'post__in' array

This question correlates with a previous question I was able to solve here: http://wordpress.stackexchange.com/a/137929/28389 I am using an array for 'post__in', and I am able to run this no problem. ...
0
votes
1answer
50 views

Show custom post type filtered by category

I would like to have a custom post type which contain several sliders for showing in each category page (exact category.php), one for each as planned. All sliders were assigned to related category. ...
0
votes
2answers
39 views

How to get Tags with specific post id

I have created one post and post ID is 34 and added some Tags and Now I want to retrieve all tags with post ID. Any Idea?
0
votes
0answers
17 views

Serve different layout via URL parameter

I'd like to be able to serve up an alternative layout for single posts via an URL parameter. For example, a user going to: http://domain.com/postname/ will get the post in the normal layout and a ...
0
votes
2answers
55 views

Get posts after calculating meta key

I have 2 meta fields for the posts, eg. meta_value and meta_count. Both are numbers. I want to divide meta_value by meta_count and based on the results I want to fetch the top 10 posts. So for ...
0
votes
2answers
54 views

WP_Query of Category Not Showing First Post

I have the following loop, and only this loop, in my home.php file (apologies if I didn't paste the code properly). I have populated lorem ipsum posts, and noticed that of the five posts only four ...
0
votes
1answer
16 views

Pagination for custom query won't let me back on page 1

I have a custom query … <?php /** * The loop that displays the posts. */ ?> <ul class="post-items"> <?php $args = array( 'post_type' => array('post', 'wr_raffle'), ...
0
votes
2answers
65 views

How can I show many posts an author has per week?

I've searched around and have had no luck or success in finding a way to show how many posts an author has made in a certain period of time (e.g. - a week) Any ideas on how one would approach this? I ...
1
vote
1answer
86 views

How do I “get the next 10 posts after post_id == x”?

I am building a mobile application that is pulling the json feed from a blog. I can easily query to get the latest 10 posts for example. But next, I want to be able to query the next 10. This presents ...
0
votes
1answer
75 views

Order posts by separate menu order for different sub-categories

My scenario is as follows: Categories: 1. Category A - Sub-Category A1 - Sub-Category A2 - Sub-Category A3 2. Category B - Sub-Category B1 3. Category C 4. Category D The ...
0
votes
1answer
50 views

Ger posts from similar tags and categories

I want to retrieve 5 posts using any given post ID with following criteria: If the post with the ID has any tags, then select the posts having same tags. If the post does not have any tags, then ...
1
vote
1answer
67 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 ); ...
0
votes
1answer
53 views

Retrieve latest post by multiple categories with ID

I have the categories listed below in my product post type. Category Name: Test 1 ID: 82 Category Name: Test 2 ID: 83 Category Name: Test 3 ID: 84 Category Name: Test 4 ID: 85 Now I want to ...
0
votes
1answer
24 views

Adding a category at even positions on main loop with modified pagination

I have different categories showing over main loop. I want to add a specific category post at even positions of main loop. Example current post list with categories: cat1 cat1 cat1 cat1 required: cat1 ...
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
3answers
43 views

How would I get 1 latest post from a query for 5 posts?

So I have a wp_query which is getting the 5 most recent posts from my Wordpress site. What I want to do is from within this query, grab the most recent post and show this as a sort of 'hero' post, and ...
0
votes
1answer
14 views

Retrieving IDs of child pages which are in a different post type

I have a normal page, which has subpages in a custom post type. I've tried to get_pages based on the child_of parameter but it returns nothing. What is the best way to do this?
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
0answers
22 views

Slideshow of posts

I am trying to find a way to achieve the following: -- I have a section in my home page that lists all posts, since i am using bootstrap, i put every post in a 3 col grid, so 4 posts for each line. ...
0
votes
2answers
102 views

Replace Main Query With Custom Query

I want to replace the main query with my own custom query. The thing is I don't want to go through the hassle of manual paging. I know there's a filter posts_results but I'm not sure how to use it ...
0
votes
2answers
182 views

Wordpress query_posts by tag doesn't work anymore(?)

I had this code running fine forever. Some days ago it just started outputting nothing (just the <ul></ul>). No errors in logs: <ul style="margin-left:0"> <?php ...
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
37 views

How to create a custom search in wordpess matching with title and metadata

I want a custom search in wordpress where the search query should return results matching to post title or with a custom metadata. For example if a user is searching for "chicken" in my site, it ...
0
votes
2answers
78 views

Make assigning post to a specific category equivalent to assigning it to all categories

Allow me to explain with an example, for the sake of clarity. Please take the time to read it all to get a good idea of what I am exactly after. On my WordPress site categories are used as Editions ...
1
vote
1answer
67 views

How do I use WP_Query to get a range of posts with custom fields that have numbers with letters in them?

What I'm trying to do I am using WP_Query() to get posts based on their range for example: $args = array( 'numberposts' => -1, 'post_type' => 'page', 'posts_per_page' => -1, ...
0
votes
0answers
33 views

Query posts and return XML

Here is the short and sweet of what I am hoping to do. I would like to have a way for external websites to query mine using a game title and they would get an XML back that contains the text of the ...
0
votes
0answers
50 views

Update Post with Modified Data

Task is to take class from <pre class="php"></pre>, and add that class to <code></code> and wrap all content of <pre> into <code> after that. I am querying WP with ...
0
votes
1answer
62 views

Get latest author posts inside the loop

I have a wordpress theme which needs to retrieve the latest 3 author posts which is simply straight forward but I have ran into a sticky problem. Because I am calling this from already within the: ...
1
vote
1answer
242 views

Get random posts between specific dates / of specific age

I need to get post IDs from a custom post type randomly and the posts are posted within 30 days. But I can't really find a solution. How can I do it? This is my query. ...
0
votes
1answer
43 views

Multiple loops on a Search result page?

I have a custom template that displays search results based on a plugin. The wp_query contains all the taxonomy information to show the proper posts. How can I have two loops on the same results ...
0
votes
1answer
125 views

Blogroll - Different layout for first post

I would like to have my main blogroll show 10 posts per page, but the first post of each page to be setup on a different div above the rest and have a featured image. This is what I sued for the ...
0
votes
0answers
90 views

How to order query by numeric meta value?

I cannot order my query by meta value by numbers, and ordering by post order does not work too. This is my code: <?php $args = array( 'posts_per_page' => '-1', 'post_type' => ...
1
vote
1answer
549 views

Ajax load more button in Recent posts widget

I create Recent posts widget and i trying to create load more button for it to get more Recent posts links by ajax ,is there any tutorial for how to make it?
1
vote
1answer
83 views

How use %like% in sql statement wordpress

i use a like %text% statement in wordpress: SELECT * FROM location WHERE name LIKE "%on" OR name LIKE "%on%" i tried anything but it's not run: $wpdb->get_results($wpdb -> prepare("SELECT ...
0
votes
1answer
41 views

Limiting post list by taxonomy

I currently have the following code pulling the 10 latest posts from a specific category, I would like to filter those posts to a certain custom taxonomy which I've set up called article type. What ...
0
votes
0answers
71 views

Can't get pagination to work

I'm trying to create pagination on a blog post page where one page displays 13 blog posts and then displays some links to go to another page. Now just to get it working, I'm using this code: <?php ...
0
votes
1answer
121 views

Why does Wordpress search returns same number of results for every search query?

I am hitting a brick wall, I am searching something on a site I am building and on every search it returns 10 results when I know in the index in relevanssi it shows more for the term I am searching ...
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
1answer
527 views

WP_Query get posts from custom posts by category

ive been playing around with this for ages and for some reason I cant get it to work. This is from within the single post page of a custom post type... Basically I am getting the category of the ...
0
votes
1answer
38 views

How to Include a common category in a custom Category Search

I was wondering how to solve this issue. This is my Query: $query = new WP_Query( array( 'posts_per_page' => 6, 'orderby' => 'date', 'order' => 'DESC', 'category__not_in' ...
0
votes
0answers
31 views

Why I getting only 1 post?

I'm using the following basic code: <?php get_header(); ?> <?php $args = array( 'status' => 'publish', 'post_type' => 'radio', 'orderby' => 'date', 'order' ...