Tagged Questions
0
votes
1answer
35 views
How to display posts from specific category using get_option function?
I try to display posts from specific category only in a author page, using get_option function like in the code below but it does not work:
<?php query_posts('cat='.get_option('admin_cat')); ?>
...
0
votes
0answers
22 views
How to replace an ID with a get_option function in wordpress?
This is my code to retrieve the related posts from the same author in Wordpress:
<?php function get_related_author_posts() {
global $authordata, $post;
$authors_posts = get_posts( array( ...
0
votes
1answer
46 views
How to use Greek characters/letters in a query?
I have a problem with Greek characters in a query.
Here is the code
Using the Greek characters in the 'meta_value' => 'Ναι' the query can't work, because of the language.
How can i make it work?
-1
votes
0answers
25 views
Execute mySQL query on publishing of post
I would like to post some data to a db when certain categories are selected in a WP post. I would like this to action when the post is made.
This is the query I want to run:
mysqli_query( $con, ...
0
votes
0answers
20 views
Run a query when in last category
Can anyone help? ive searched google but with no luck.
currently Accounts has sub categories but no posts
/accounts/ = /billing1/ + /finance/
Billing and finance have posts but don't want ...
0
votes
1answer
55 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
52 views
How to exclude 2 Portfolio Categories from page?
I want to exclude 2 Portfolio categories (IDs 4 & 23) from a page using the code below but it still displays all categories. Similar code works for 'Posts' but not for 'Port' - can anyone see what ...
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
1answer
110 views
wordpress category.php query for featured news item, broken pagination and repeating posts
I am having a few issues with a site I am building, on the news page It has 1 featured post from the news category and then under that more news category posts, but missing out the featured news item ...
0
votes
1answer
43 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
2answers
192 views
SQL query to get posts from multiple categories but not in a category
I need to get the last posts' ID and the post_tile within categories 1 and 2, and exclude those within category 3. It must be SQL, because if I use WP_Query it retrieves too much info and I only need ...
2
votes
2answers
119 views
Rearranging posts based on categories
Hey everyone on Stackexchange!
I'm trying to find a way to prioritize posts based on a category in a loop, which is sorted by dates. All posts are grouped under their respective dates. The date ...
0
votes
1answer
391 views
Displaying Portfolio Filter by Category Order (alphabetically)
I have created a custom post type to display churches in Europe. I used this tutorial to make it filterable: http://wp.tutsplus.com/tutorials/creating-a-filterable-portfolio-with-wordpress-and-jquery/
...
0
votes
1answer
130 views
Get 1st parent category id from post
I have this structure for my categories:
Issue 4
- News
- Supporting our troops
- Breaking news
<?php
$category = get_the_category();
$parent = ...
0
votes
1answer
188 views
Query Posts with MetaValue & MetaKey & SortOrder works, but it doesn't override category order [closed]
I have a query, ordered correctly by the meta_key in ascending order, but they are devided into groups of their category.
This example shows the postorder in the WP category editor:
Cat 6
- sub 1
- - ...
1
vote
0answers
70 views
category pagination got broken suddenly
i need some help here please!
The pagination just stopped working suddenly with the default post type and default wp query, with plugin "wp-paginate" or even with next/prev arrows!
It echo 404 error ...
0
votes
1answer
115 views
Conditional category query breaking?
In my loop.php (see below) I basically have a condition where if the page is not paginated (i.e. if the URL does not look something like this: example.com/page/2) then display 2 posts with a category ...
0
votes
2answers
751 views
Exclude category from query
PROBLEM
Hey everyone I have the wp loop to display posts, but I need to exclude category 81.
I tried: query_posts('cat=-81'); ?> before the loop but the pagenavi is broken and it doesn't work ...
0
votes
1answer
248 views
How to Check if a Child Category is Being Queried
I need to change the number of posts queried for specific categories 'Recipes' or 'Product Reviews'. The below code works great for this, I have it in functions.php:
function ...
1
vote
1answer
720 views
How to display posts under a specific subcategory of a given category
after a long search online I have decided to post my problem here in the hope of getting a solution to this issue. Well, I have a custom post with various categories (novels, books, magazines etc..) ...
1
vote
3answers
171 views
query in category.php repeats itself
I'm need some help on my query.
I'm building up a category page where on top a post need to show where custom field key 'uitleg' has value 'ja'. Per category there is only one post with that value. ...
0
votes
2answers
327 views
Display latest post from Wordpress Featured Category that is also in X,Y,or Z categories
I want to display the latest post from a "featured" category (id=1) that may also be in either X category, Y category, or Z category (id=2,3,4 respectively). Note, there are other posts in categories ...
0
votes
1answer
249 views
Get current taxonomy and display query accordingly
Okay i'm having a bit of a catogorisation/taxonomy/filtering problem here and am at loss on how to solve this.
I hope someone could help me on the way a bit.
Say I've got a blog about food, with a ...
0
votes
2answers
556 views
get_the_category and echo out link to child-most/deepest category
I have this code which is located on the search.php page and retrieves all the categories for each post and echo's out a link to the first category:
$category = get_the_category(); ...
0
votes
3answers
263 views
And/Or Category Query
I'm having a lot of trouble using php query_posts(array('category__and'=>array(1,3))) - it seems to be pulling anything that's in category 1 regardless of whether it's also in category 3 and I only ...
0
votes
1answer
381 views
Query the Loop without breaking it
Im trying to make different querys in my category like one with a offset of post and one that shows one post but while it continues to go through the loop, this is what i have but the loop keeps ...
-1
votes
1answer
1k views
Multiple Category Query
Is it possible to display a wordpress category page but have it pull posts from mulitple categories?
For example, let's say I need to pass in params for cat_id in this fashion
...
1
vote
1answer
367 views
Disallow categories from this MySQL query
I'm trying to modify a plugin that generates an archive listing so it shows only one category, making it a single category archive.
The old version of the plugin used a get_posts query, and so it was ...
0
votes
1answer
2k views
Overriding default calendar to show posts from a category
I'm trying to modify the default WP calendar (get_calendar()) so that it shows posts from a specific category and then use that as a shortcode.
Here's what I've done:
Copied across the ...
0
votes
2answers
927 views
Display posts separated by Category in Author's page
I created an author's page using:
<?php
if(isset($_GET['author_name'])) :
$curauth = get_userdatabylogin($author_name);
else :
$curauth = get_userdata(intval($author));
endif;
?>
...
0
votes
4answers
2k views
How to filter post from categories only if the posts appears in one of them, not the other?
The scenario is, some posts have one category, ok. Some others have more than one category.
I must create post with content and also slideshow thumbnails for use with Nivo plugin gallery. Ok.
I want ...
