Forums

[plugin: Archives for a category] using a custom field for cat id (3 posts)

  1. staceyk18
    Member
    Posted 2 years ago #

    Hi,

    I am wanting to use a custom field for the category id to be pulled through for this plugin to work, but I am not sure how to structure the code to get it to work.

    Any ideas anyone? custom field for the page is catid

    This is what I have at the moment (I know it doesnt work).

    <?php $catid = get_post_meta($post->ID, 'catid', true);
    echo wp_get_archives('cat=.$catid&limit=10'); ?>

    Thanks in advance!

    Stacey

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    Can't do that with wp_get_archives. You'll need to use a new WP Query or get_posts for that. See query_posts() or get_posts()

  3. staceyk18
    Member
    Posted 2 years ago #

    I am using the plugin Archives for a category which allows you to do this with a number, but wanted to do it by custom fields...

Topic Closed

This topic has been closed to new replies.

About this Topic