• Resolved abdessamed

    (@abdessamed)


    Hello there
    I’m using TAG Shortcode in my shop page but TAG name not shown before products, so if there any way to show the name before any TAG.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support Shohan Hossain Nabil – a11n

    (@sohanhossain)

    Hello @abdessamed,

    I’m using TAG Shortcode in my shop page but TAG name not shown before products, so if there any way to show the name before any TAG.

    I am having a bit of trouble understanding the problem here. Could you please share the shortcode that you are using? Please explain more about the shortcode so that I can understand the problem and direct you in the right direction. Are you using any 3rd-party plugin for the shortcode?

    We will be standing by for your response.

    Thanks!

    Thread Starter abdessamed

    (@abdessamed)

    <?php 
                $args = array(
                    'number'     => $number,
                    'orderby'    => 'title',
                    'order'      => 'ASC',
                    'hide_empty' => $hide_empty,
                    'include'    => $ids
                );
                $product_tags = get_terms( 'product_tag', $args );
                $count = count($product_tags);
                if ( $count > 0 ){
                   // echo do_shortcode( '[product_categories]' );
                    foreach ( $product_tags as $product_tag ) {
                        if ($product_tag->count>0 ){
                            echo is_product_tag( $product_tag->name );
                                var_dump($tags_array);
                            echo '<h3 class="tagname"> ' . $product_tag->name . '</a></h3>';
                            echo do_shortcode( '[products tag="'.$product_tag->slug.'"]' );
                            
                        }
                        
                     
                    }
                }
             ?>

    thats the code that i’m using, it’s work but when i use annasta filter plugin to filter products the title stil visible for tags that have not results.

    Thread Starter abdessamed

    (@abdessamed)

    [products tag=”product_tag” ]
    i want that shortcode to include TAG Name

    Thread Starter abdessamed

    (@abdessamed)

    @sohanhossain is there any solution for this ??

    • This reply was modified 5 years, 1 month ago by abdessamed.
    Plugin Support Shohan Hossain Nabil – a11n

    (@sohanhossain)

    Hello @abdessamed,

    Thanks for getting back to us and sharing the code. However, the information you have shared is not sufficient to understand your end goal. What I understood so far is that you are trying to display Tag Name somewhere but I am not exactly sure where. Could you please explain your end goal and the expected result? Please share as much as details possible.

    Thanks!

    Thread Starter abdessamed

    (@abdessamed)

    Sorry my English is bad,
    so this is my shop page

    the filter plugin support only default shop page or shortcodes, so I customize my archive page using products tags shortcode, but default shortcode do not show tag name so I made a loop to show tag name before products, but the problem here is when I filter products the tag title for empty results still appear.

    Plugin Support Shohan Hossain Nabil – a11n

    (@sohanhossain)

    hi @abdessamed,

    Thank you for getting back.

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Thanks!

    Thread Starter abdessamed

    (@abdessamed)

    thanks a lot Mr @sohanhossain
    Finaly i found a solution for my problem
    i made a global varible for $product_tag->name and i call it in loop-start.php file and it work’s perfectly, so now when i’m using the filter it show just the titles that has in the results.

    Plugin Support Shohan Hossain Nabil – a11n

    (@sohanhossain)

    Hi @abdessamed,

    Finaly i found a solution for my problem
    i made a global varible for $product_tag->name and i call it in loop-start.php file and it work’s perfectly, so now when i’m using the filter it show just the titles that has in the results.

    Glad to hear it – thanks for letting us know!

    I’ll mark this thread as resolved now. If you have any further questions, I recommend creating a new thread.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Get title for TAG Shortcode’ is closed to new replies.