+ 2

How to display popular tags is homepage?

I want to have a section that contains POPULAR TQGS So there is a problem i write the function and I can't add it to homepage with shortcode function bloo_tag_cloud() { $tags = get_tags(); $args = array( 'smallest' => 10, 'largest' => 10, 'unit' => 'px', 'number' => 10, 'format' => 'flat', 'separator' => " ", 'orderby' => 'count', 'order' => 'DESC', 'show_count' => 1, 'echo' => false ); $tag_string = wp_generate_tag_cloud($tags, $args); return $tag_string; } add_shortcode('bloo_popular_tags', 'bloo_tag_cloud'); add_filter('widget_text', 'do_shortcode');

20th Oct 2020, 4:03 PM
gitbanaei
gitbanaei - avatar
1 ответ
0
$postTags = get_the_tags(); if ( ! empty( $post_tags ) ) { echo '<ul>'; foreach( $post_tags as $post_tag ) { echo '<li><a href="' . get_tag_link( $post_tag ) . '">' . $post_tag->name . '</a></li>'; } echo '</ul>'; }
20th Oct 2020, 5:51 PM
JaScript
JaScript - avatar