Support » Plugin: Recipe Hero » Adding list of cuisines/courses

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Captain Theme

    (@captaintheme)

    Hey! 🙂 Thanks for using Recipe Hero.

    There isn’t a built in way but cuisines / courses are actually just taxonomies, so it’s really easy to using something like with get_terms().

    Here’s a really simple example of using it to make a list of cuisines with links to the ‘archives’ of them (and hiding the empty ones):


    $args = array( 'hide_empty=1' );

    $terms = get_terms( 'cuisine', $args );
    if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
    $count = count( $terms );
    $i = 0;
    $term_list = '<p class="my_term-archive">';
    foreach ( $terms as $term ) {
    $i++;
    $term_list .= 'name ) . '">' . $term->name . '';
    if ( $count != $i ) {
    $term_list .= ' · ';
    }
    else {
    $term_list .= '</p>';
    }
    }
    echo $term_list;
    }

    Try that and let me know how you go!

    I’ve also added this to the Recipe Hero roadmap – https://trello.com/c/H0R8sHaL/11-shortcode-method-to-list-cuisines-and-courses – as I think it’d be interesting to look into maybe introducing a shortcode or something like that to make this easier.

    Don’t wanna impose on an already closed topic, but here’s another way to do it, maybe it helps somebody:

    <?php
    $courses_args = array(
    	'orderby'            => 'name',
    	'order'              => 'ASC',
    	'taxonomy'           => 'course',
    	'title_li'           => '',
    );
    wp_list_categories( $courses_args );
    ?>

    I made a widget like this.

    Plugin Author Captain Theme

    (@captaintheme)

    Hey Vlad,

    Thanks so much for that! I’m going to add it to the docs 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Adding list of cuisines/courses’ is closed to new replies.