Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • 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.

    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.

    Thread Starter abdessamed

    (@abdessamed)

    @sohanhossain is there any solution for this ??

    • This reply was modified 5 years, 1 month ago by abdessamed.
    Thread Starter abdessamed

    (@abdessamed)

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

    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)

    Thank you very much
    it work with shortcode
    this is the code that i’m using now

     <?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 ){
                    foreach ( $product_tags as $product_tag ) {
                        if ($product_tag->count>0){
                            echo '<h3 class="tagname">' . $product_tag->name . '</a></h4>';
                            echo do_shortcode( '[products tag="'.$product_tag->slug.'"]' );
                        }
                        
                     
                    }
                }
             ?>
                <?php 
    • This reply was modified 5 years, 4 months ago by abdessamed.
Viewing 6 replies - 1 through 6 (of 6 total)