Support » Plugins » Hacks » Calling a custom category

  • I am creating a custom template called “city index”. The file needs to include an index for a specific category (among other things). Right now, I’ve figured out how to hard-code the category into the template file:

    <?php
    query_posts('cat=61');
    if(have_posts()) :?>

    Where 61 is the category I would like to use.

    I would like to replace 61 with a custom field, specified for the page.

    So something that lets me use something like:
    <?php echo get_post_meta($post->ID, ‘category', true); ?>

    where I specify “61” in a custom field associated with the page.

    I’m a complete PHP newbie, so what do I need to do to insert the above where “61” is? Will that work? Is there a better method? Any feedback offered is appreciated.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Calling a custom category’ is closed to new replies.