• Resolved lennydelmar

    (@lennydelmar)


    Hello there,
    I wondering if there any solutions on how can I show the tags of each listing on grid-view archive. I already found in the code of ‘loop-grid.php’ the place (meta section at the very bottom) where I could paste the code allowing me to show the tags. Would be appreciate any help!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support rashed848

    (@rashed848)

    Hello @lennydelmar!
    
    Thanks for reaching out. 
    
    You can use the following code for templates>archive>loop-grid.php. 
    
    
    
    <?php/**?* @author ?wpWax?* @since ? 6.6?* @version 6.7?*/
    if
    
    ( ! defined
    
    ( 'ABSPATH'
    
    ) ) exit
    
    ;
    $loop_fields
    
    = $listings
    
    ->loop
    
    ['card_fields'
    
    ]['template_data'
    
    ]['grid_view_with_thumbnail'
    
    ];$id
    
    = get_the_ID
    
    ();$tags
    
    =get_the_terms
    
    ( $id
    
    , 'at_biz_dir-tags'
    
    );
    ?>
    <divclass
    
    ="directorist-listing-single directorist-listing-card directorist-listing-has-thumb <?phpechoesc_attr
    
    ( $listings
    
    ->loop_wrapper_class
    
    () ); ?>">
    <figureclass
    
    ="directorist-listing-single__thumb">
    <?php$listings
    
    ->loop_thumb_card_template
    
    ();$listings
    
    ->render_loop_fields
    
    ($loop_fields
    
    ['thumbnail'
    
    ]['avatar'
    
    ]);?>
    <divclass
    
    ="directorist-thumb-top-left"><?php$listings
    
    ->render_loop_fields
    
    ($loop_fields
    
    ['thumbnail'
    
    ]['top_left'
    
    ]); ?></div><divclass
    
    ="directorist-thumb-top-right"><?php$listings
    
    ->render_loop_fields
    
    ($loop_fields
    
    ['thumbnail'
    
    ]['top_right'
    
    ]); ?></div><divclass
    
    ="directorist-thumb-bottom-left"><?php$listings
    
    ->render_loop_fields
    
    ($loop_fields
    
    ['thumbnail'
    
    ]['bottom_left'
    
    ]); ?></div><divclass
    
    ="directorist-thumb-bottom-right"><?php$listings
    
    ->render_loop_fields
    
    ($loop_fields
    
    ['thumbnail'
    
    ]['bottom_right'
    
    ]); ?></div></figure>
    <divclass
    
    ="directorist-listing-single__content"><divclass
    
    ="directorist-listing-single__info"><divclass
    
    ="directorist-listing-single__info--top"><?php$listings
    
    ->render_loop_fields
    
    ($loop_fields
    
    ['body'
    
    ]['top'
    
    ]); ?></div><divclass
    
    ="tags"><?phpif
    
    ($tags
    
    && ! is_wp_error
    
    ( $tags
    
    )) : ?><iclass
    
    ="directorist-icon-mask"aria-hidden
    
    ="true"style
    
    ="--directorist-icon: url(https://february.local/wp-content/plugins/directorist/assets/icons/line-awesome/svgs/tag-solid.svg)"></i><divclass
    
    ="directorist-listing-single__tags"><?php$count
    
    = count
    
    ($tags
    
    ); ?><?phpforeach
    
    ($tags
    
    as $i
    
    => $tag
    
    ) : ?><ahref
    
    ="<?phpechoesc_url
    
    (get_term_link
    
    ($tag
    
    )); ?>"rel
    
    ="tag"><?phpechoesc_html
    
    ($tag
    
    ->name
    
    ); ?></a><?phpif
    
    ($i
    
    < $count
    
    - 1
    
    ) { echo', '
    
    ; } ?><?phpendforeach
    
    ; ?></div><?phpendif
    
    ; ?></div>
    <divclass
    
    ="directorist-listing-single__info--list"><ul><?php$listings
    
    ->render_loop_fields
    
    ($loop_fields
    
    ['body'
    
    ]['bottom'
    
    ], '<li>'
    
    , '</li>'
    
    ); ?></ul></div><divclass
    
    ="directorist-listing-single__info--excerpt"><?php$listings
    
    ->render_loop_fields
    
    ($loop_fields
    
    ['body'
    
    ]['excerpt'
    
    ]); ?></div></div>
    <divclass
    
    ="directorist-listing-single__meta"><divclass
    
    ="directorist-listing-single__meta--left"><?php$listings
    
    ->render_loop_fields
    
    ($loop_fields
    
    ['footer'
    
    ]['left'
    
    ]); ?></div><divclass
    
    ="directorist-listing-single__meta--right"><?php$listings
    
    ->render_loop_fields
    
    ($loop_fields
    
    ['footer'
    
    ]['right'
    
    ]); ?></div></div>
    </div>
    </div>
    
    
    Let me know if you have further queries. 
    
    Kind Regards
     
    Thread Starter lennydelmar

    (@lennydelmar)

    Thank you for your reply. I was really waiting for that. But unfortunately the code has many syntax error. I already working on it but still cannot find them all. It doesn’t return any listings at all. Could you please provide me with the working one.

    As I understood, the important part is to add to the top of the loop-grid.php the following code

    $id = get_the_ID();
    $tags=get_the_terms( $id, ‘at_biz_dir-tags’);

    And I need to place further code in directorist-listing-single__meta area replacing the content. But seems the code you suggested has some syntax error.

    Plugin Support rashed848

    (@rashed848)

    Hello @lennydelmar !

    I need to check the environment. There are several CSS adjust need to be done. Would you please create reach out through our support channel so that we can check review the code in your site.

    Kind Regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to show tags on listing cards grid view’ is closed to new replies.