Change Category Selector to Tags or Post Type (2 posts)

  1. wampdog29
    Posted 4 years ago #

    If I could get any help with this, it would be great.
    What I am trying to do is take code I wrote for my theme options to select categories and post them into a highlights section on my front page. Here is my code that works as is:

    <strong>Highlights Category 1:</strong>
    <p class="wpn_desc">Here you set the category that you want to use for the highlights area.</p>
    <p><select name="highlights_category_id_1">
    <option value="0" <?php if (!$options['highlights_category_id_1']) echo 'selected="selected"'; ?>>Disabled</option>
    <?php $categories = get_categories(); foreach($categories as $cat) : ?>
    <option value="<?php echo $cat->term_id; ?>" <?php if ($options['highlights_category_id_1'] == $cat->term_id) echo 'selected="selected"'; ?>><?php echo $cat->cat_name; ?></option>
    <?php endforeach; ?>

    Now, what I really want is to change the category selection to either a post type selection, custom taxonomy or simply tags. I would love to have it as a post type selector the most, however, trying something as simple as tags leaves nothing in the drop down box to be selected. Like I said, it should be easy to do for tags, but I can't get it to work.

    Any help would be greatly appreciated.
    URL: http://greatgamingcrusade.com

  2. Star Verte LLC
    Posted 3 years ago #

    For tags, you might check out using the get_the_tag_list function.

    For post type, you might check out using the get_post_types function.

    I was really looking to see if someone had found a way to implement a Post selector tool. However, I may have answered my own question by looking at your code and by looking at the get_posts function.

    Once I figure that out, and if I feel it may be helpful to your problem, I will let you know... unless someone jumps in and lets us know of an easier way to do these things.

Topic Closed

This topic has been closed to new replies.

About this Topic