F
F
Ferzet2016-03-29 20:25:04
WordPress
Ferzet, 2016-03-29 20:25:04

Why duplicate labels in wordpress?

Faced such a problem. Labels are duplicated on the blog, starting from the first entry, the label is added to all previously added ones. Here's what it looks like:
c670f914d04747d9a0268e61ca78ae45.png
The actual code:

<?php
                                $posttags = get_the_tags();
                                if ($posttags) { 
                            ?>
                            <span class="root">
                            <i class="icon icon-root"></i>
                            <?php foreach($posttags as $tag) {
                                    $tag_links[] = '<a href="' . get_tag_link($tag->term_id) . '">' . $tag->name . '</a>';
                                    }
                                    echo join( ', ', $tag_links );
                                }
                            ?>
                        
                        </span>

What's the matter? Help!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Aksentiev, 2016-03-29
@Sanasol

$tag_links[]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question