• Resolved labyrinth207

    (@labyrinth207)


    I had created 3 categories, Buy, Sell, and Swap within the classifieds.

    Now I want to display the category inside the title using the [adverts_list]
    (see https://prnt.sc/qqj6un) while translating the category name

    Buy -> Looking for [Item Title]
    Sell -> Selling [Item Title]
    Swap -> Swap for [Item Title]

    I had done some experiments but unable to achieve the desired result
    Your help is deeply appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    You can display category name after the title by adding the code below in your theme functions.php file

    
    add_action( "adverts_list_after_title", "my_adverts_list_after_title" );
    function my_adverts_list_after_title( $post_id ) {
        $advert_category = get_the_terms( $post_id, 'advert_category' );
        if( empty( $advert_category ) ) {
            return;
        }
        echo '<span style="display:inline-block;">';
        foreach($advert_category as $c) {
            echo join( " / ", advert_category_path( $c ) );
        }
        echo '</span>';
    }
    
    Thread Starter labyrinth207

    (@labyrinth207)

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Displaying category inside title’ is closed to new replies.