• Resolved Pedro Magnifico

    (@pedro-magnifico)


    Hello!

    I am using this code to display a list of posts via shortcode:

    
    <?php 
    function show_bridal_events(){
    global $post;
    // get posts
    $posts = get_posts(array(
        'post_type' => 'bridal_shows_events',
        'category' => 1221,
        'posts_per_page' => 6,
        'meta_key' => 'date_time_code',
        'orderby' => 'meta_value',
        'order' => 'ASC'
    ));
    if( $posts ): ?>
        <ul>
        <?php foreach( $posts as $post ): 
            setup_postdata( $post )
            ?>
            <li>
                <a href="<?php the_permalink(); ?>"><?php the_title(); ?> </a>
            </li>
        <?php endforeach; ?>
        </ul>
        <?php wp_reset_postdata(); ?>
    <?php endif; } ?>
    
    

    Now I am replacing category 1221 in the code above with a custom taxonomy.

    The new taxonomy is bridal_show_event_category and the new category id is 2365.

    • I tried replacing
    ‘category’ => 1221,
    with
    ‘category’ => 2365,
    this made no list be displayed.

    • I tried replacing
    ‘category’ => 1221,
    with
    ‘bridal_show_event_category’ => 2365,
    this made no list be displayed.

    Can you give me any guidance how to go about this?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Looking for help displaying custom taxonomy’ is closed to new replies.