Tags in Sidebar

This topic contains 9 replies, has 4 voices, and was last updated by  Alex Rollin 5 years, 5 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #453635

    Bernward Maspohl
    Full Member
    Post count: 65

    Hello,

    in the sidebar, the categories of the place are already displayed by the theme. I would also like to display the tags of the place there. Is that possible?

    Thanks for the help
    Bernward

    #453675

    Kor
    Moderator
    Post count: 16516

    Hi Bernward,

    Please share the URL of the site in question so we can take a better look at it and also WP temp admin access to your site. You can post the details here using the private reply option below.

    #453682

    Bernward Maspohl
    Full Member
    Post count: 65
    This reply has been marked as private.
    #453683

    Kor
    Moderator
    Post count: 16516
    This reply has been marked as private.
    #453691

    Bernward Maspohl
    Full Member
    Post count: 65
    This reply has been marked as private.
    #453724

    dhaval
    Moderator
    Post count: 39

    Hello Bernward,

    I have created a [gd_posts_tags] short code for display GD post types tags in post detail page. Please put below snippet on you theme functions.php file.

    [gd_posts_tags]
    
    
    function gd_posts_tags_func( $atts ) {
    
        global $post;
        ob_start();
    
        if( is_single() ) {
    
            if( !empty( $post->post_type ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
    
                $taxonomy = $post->post_type.'_tags';
                $tags_terms = wp_get_post_terms( $post->ID, $taxonomy );
    
                if( !empty( $tags_terms ) && '' != $tags_terms ) {
                    echo '<ul>';
                    foreach ( $tags_terms as $terms ) {
                        $tag_term_link =  get_term_link($terms->term_id);
                        echo '<li>';
                            echo '<a href="'.$tag_term_link.'">'.$terms->name.'</a>';
                        echo '</li>';
                    }
                    echo '<ul>';
                }
    
            }
    
        } else{
           echo __('No tags founds!','text-domain');
        }
        return ob_get_clean();
    }
    add_shortcode( 'gd_posts_tags', 'gd_posts_tags_func' );

    You can modify the code as per you requirement.

    #453880

    Bernward Maspohl
    Full Member
    Post count: 65

    Hi there,

    thank you for your fast response and work.

    I inserted the code into the functions.php. The tags of the place do not appear in the right sidebar.
    I have now created my own HTML field under the place and inserted the short code [gd_posts_tags]. But that’s not possible either:
    https://dev.oekay.de/anbieter/bauen-renovieren/gd-test-tags/

    In principle, the tags should simply appear under the categories in the sidebar. For this there would have to be a field for settings of the places for tags and for categories (taxonomy). That would be best. Or did I overlook that? I’m surprised that the categories, but not the keywords are displayed by default in the right sidebar.

    Thanks
    Bernward

    #453956

    Alex Rollin
    Moderator
    Post count: 27815

    Have you enabled shortcodes in text widgets?

    
    
    
    // Enable shortcodes in text widgets
    add_filter('widget_text','do_shortcode');
    

    Or you could use an HTML widget.

    #453989

    Bernward Maspohl
    Full Member
    Post count: 65

    Hi Alex,

    That’s it! Great work!

    Thanks for the quick help
    Bernward

    #454012

    Alex Rollin
    Moderator
    Post count: 27815

    Excellent!

    Write back if you run into any more issues.

Viewing 10 posts - 1 through 10 (of 10 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket