Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Forum: Plugins
    In reply to: Question – PHP variables

    Otto42 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 variables

    One 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 variables

    Just 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 variables

    Thanks 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 variables

    Been 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

Viewing 5 replies - 1 through 5 (of 5 total)