salogan
Forum Replies Created
-
Forum: Plugins
In reply to: Question – PHP variablesOtto42 mentioned a get_the_category_list() function that isn’t on the Template_Tags page? I can’t find any reference to it anywhere else. Otto – how come you know about it?!
Steve
Forum: Plugins
In reply to: Question – PHP variablesOne last question, Otto….
Is there a complete list somewhere of all the functions like get_the_category() etc??
Forum: Plugins
In reply to: Question – PHP variablesJust found an even easier way…
I want to print out posts in ascending date order for only one category, so…
(my calendar is category 2 and I only want entries from category 7)
<?php query_posts('cat=2&orderby=date&order=DESC');
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php if ( in_category(7) ) : ?>
do stuff
<?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>
Works fine…
Forum: Plugins
In reply to: Question – PHP variablesThanks Otto, your first guess is exactly what I did. I run get_the_category() and look through the returned array and display only those that are in the required category. The results is a nice ‘what’s on next’ page sorted correctly by date for one category.
I recommend this page (http://codex.ww.wp.xz.cn/Database_Description) for folks trying to determine how to get stuff out of the db.
Thanks again…
Forum: Plugins
In reply to: Question – PHP variablesBeen tearing out what little hair I have left trying to do exactly the same thing.
I’m running a query based on a ‘calendar’ category (I’m using Event Calendar 3.1 which sorts things nicely in that category) and I then want to only display posts if they are member of another category. So I thought I’d simply find out what categories a post is in and do an ‘if’.
Anyone got any ideas how to get access in PHP to the categories of a post?
Thanks