Get categories found in query - wordpress

I need to build a list of all categories and tags that contain a search result for a wordpress query.
e.g. a search in WP for "lorem" delivers 5 posts. Each of the posts has another category. How can I get all the category names? I know how to get the number of posts ($wp_query->found_posts) but not the found category names.
thx for your help!

found it... duh!
<?php get_the_category_list(); ?>
thx

Related

Adding additional names to a category in Wordpress

Strange question which is typically against how Wordpress works but I'm wanting to add additional names to a category, almost like a "also known as".
So might have "Tech talk" as what the category is called but wanting to add "Bob Billy" (for example) as what the category can also be known as. I know about sub categories and this isn't what I mean.
Thanks.
In wordpress categories, have description. you can use the description and show it anywhere on your blog/website. this is the case where you have just one alternative for each category and not more.
According to the documentation:
<?php echo category_description( $category_id ); ?>
Returns the description of a category defined in the category settings screen for the current category (Posts > Categories).
Please let me know if it fits your needs, or I will hand you another way to acomplish that :)

Assigning two routes to the same category in Wordpress

I wonder if it is possible to assign two routes to the same category. For example:
By accessing http://myblog.com/action or http://myblog.com/movie-action, leads me to the same category destination.
Thank you
i Think this plugin can handle this
http://wordpress.org/plugins/quick-pagepost-redirect-plugin/
it makes all kind of redirections in wordpress
One way to do this is to make all posts have both categories and then the links come up the same.
However, to do literally what you are asking, let's say you want to get to Category Action through Category Movie Action. See making categories in the Codex.
Create a .php file for the category you want to redirect. In this, make
category-movie-action.php
In this file, you can just paste the code
<?php
header( 'Location: http://myblog.com/action' ) ;
?>
And that should redirect anyone who goes to that particular category. If you need a more elegant solution I'm sure there are ways as well.

Wordpress Category.php not showing all posts in that cateogry

I am having an issue with my category showing all post from that category. My code is here: Category Loop
I have it set up to show my posts in 3 columns. You can see it in action here. There are like 48 posts that should show up, but for some reason I only get 10.
Any suggestions?
10 is the default value of the query variable posts_per_page. You use have_posts() and the internal Wordpress mechanisms to retrieve posts, hence you are limited by this number. You can change it like this:
query_posts( 'posts_per_page=50' );
See this page: http://codex.wordpress.org/Function_Reference/query_posts

Returning number of posts in Wordpress

I need a function to calculate the number of posts in a Wordpress blog that is aware if you are looking at a category, a given tag or the whole blog.
I'm keen to avoid rewriting for every different circumstance and want to make sure I get off on a reliable path. Relatively new to Wordpress any help appreciated.
Thanks
If you want to retrieve a count of all the posts in a blog, use wp_count_posts(). To get post counts from a specific category, do a count() on a call to get_posts() with the category ID specified as a parameter.
Example:
<?php
$posts = get_posts('category=1');
$count = count($posts);
echo $count;
?>
Unfortunately WordPress' wp_count_posts() function won't count a category's posts. It'll only count different post types, i.e posts, pages, drafts, and in 3.0, custom post types.
Provides a template function: WordPress › Count Posts « WordPress Plugins. Could borrow the code from it and integrate it into your theme's functions.php file.

Related posts from the blogosphere - dynamic integration of Google Blogsearch RSS on wordpress category pages

I'm looking for a method to put the three latest "news" from Google Blogsearch/Twitter search feeds into the bottom of category Pages. Maybe like this (assuming we're on the archive page for the "Sports" category):
What others say about "Sport":
Instapundit - Michael Jordan Comeback!
Huffington post - Michael Jordan Comeback!
Crazyguy - Michael Jordan Comeback!
So we all know that you can put
<?php include_once(ABSPATH.WPINC.'/rss.php');
wp_rss('pathtofeed.com', 3); ?>
in a template-file and it will list the latest three items of a feed.
I would like to put the path to the feed of a query to Google Blogsearch, e.g. [http://blogsearch.google.com/blogsearch_feeds?hl=en&q=sport&ie=utf-8&num=10&output=rss][1]
Works fine. But I would like to replace the sport query with the template tag for the category title - so it dynamically queries Google for a RSS-feed of sport searches. I've tried this:
<?php
include_once(ABSPATH.WPINC.'/rss.php');
wp_rss('www.blogsearch.google.com/blogsearch_feeds?hl=en&q=<?php single_cat_title() ?>&ie=utf-8&num=10&output=rss', 3);
?>
(omitted 'http' cause I can't post hyperlinks here as a new user).
But all I get is:
There was a problem with the feed, try again later.
(translated from Danish error message).
Is it the syntax?
You've got a couple of issues in that code.
The first is you have a <?php inside an already opened <?php section. Concatenation is the answer to that problem.
The second is the function single_cat_title() displays the category title by default. Meaning it "echo()"s it out. So you need to tell that function to return the value not display it.
My solution would be to add a line of code above your include there to get the category you're looking for along the lines of:
$current_category = single_cat_title("", false);
The "false" tells the function to return it as a value instead of displaying it by default, the first parameter is the prefix or the text to display before the category title.
Then concatenate the current_category variable into your include statement
You can check out that function on the Template Tags page in the Wordpress Codex.

Resources