List all the tags in a WordPress blog
I need to list all the tags with at least 1 published post in a WordPress blog.
The list is about the full blog and not related to the current post.
What code would you use?
php wordpress tags
add a comment |
I need to list all the tags with at least 1 published post in a WordPress blog.
The list is about the full blog and not related to the current post.
What code would you use?
php wordpress tags
3
What code did you try? Did you at least google something like 'Wordpress show all tags'?
– RST
Sep 25 '16 at 9:13
2
Possible duplicate of get all tags of published posts Wordpress
– MarZab
Sep 25 '16 at 9:21
add a comment |
I need to list all the tags with at least 1 published post in a WordPress blog.
The list is about the full blog and not related to the current post.
What code would you use?
php wordpress tags
I need to list all the tags with at least 1 published post in a WordPress blog.
The list is about the full blog and not related to the current post.
What code would you use?
php wordpress tags
php wordpress tags
asked Sep 25 '16 at 9:07
maryamarya
4818
4818
3
What code did you try? Did you at least google something like 'Wordpress show all tags'?
– RST
Sep 25 '16 at 9:13
2
Possible duplicate of get all tags of published posts Wordpress
– MarZab
Sep 25 '16 at 9:21
add a comment |
3
What code did you try? Did you at least google something like 'Wordpress show all tags'?
– RST
Sep 25 '16 at 9:13
2
Possible duplicate of get all tags of published posts Wordpress
– MarZab
Sep 25 '16 at 9:21
3
3
What code did you try? Did you at least google something like 'Wordpress show all tags'?
– RST
Sep 25 '16 at 9:13
What code did you try? Did you at least google something like 'Wordpress show all tags'?
– RST
Sep 25 '16 at 9:13
2
2
Possible duplicate of get all tags of published posts Wordpress
– MarZab
Sep 25 '16 at 9:21
Possible duplicate of get all tags of published posts Wordpress
– MarZab
Sep 25 '16 at 9:21
add a comment |
3 Answers
3
active
oldest
votes
$tags = get_tags();
$html = '<ul>';
foreach ( $tags as $tag )
if($tag->slug != "migliori")
$tag_link = get_tag_link( $tag->term_id );
$html .= "<li><a href='$tag_link' class='$tag->slug'>";
$html .= "$tag->name</a></li>";
$html .= '</ul>';
echo $html;
This works.
add a comment |
I tried this and worked for me.
<?php
$tags = get_tags();
if ($tags)
?><ul class="tags"><?php
foreach ($tags as $tag)
echo '<li><a href="' . get_tag_link( $tag->term_id ) . '"
title="' . sprintf( __( "View all posts in %s" ), $tag-
>name ) . '" ' . '>' . $tag->name.'</a></li>';
echo '<li><a href="#">View All</a><span class="arrow"></span>
</li>'; ?></ul>
<?php ?>
add a comment |
edit this code and work for me !!!
<ul class="tags">
<?php
$tags = get_tags('post_tag'); //taxonomy=post_tag
//echo "<pre>";
//print_r($tags);
//var_dump($tags);
if ( $tags ) :
foreach ( $tags as $tag ) : ?>
<li><a class="tag" href="<?php echo esc_url( get_tag_link( $tag->term_id ) ); ?>" title="<?php echo esc_attr( $tag->name ); ?>"><?php echo esc_html( $tag->name ); ?></a></li>
<?php endforeach; ?>
<?php endif; ?>
</ul>
Can you add some explanation to this code? To me, it looks like a scrambled copy of other answers
– Nico Haase
Nov 14 '18 at 9:41
But this code show all tags. But i showing particular single post tag listing. can you use this code. <?php the_tags( '<ul class="tags"> <li class="tag">', '</li><li class="tag">', '</li></ul>' ); ?>
– Purnendu Sarkar
Nov 15 '18 at 7:13
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f39685167%2flist-all-the-tags-in-a-wordpress-blog%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
$tags = get_tags();
$html = '<ul>';
foreach ( $tags as $tag )
if($tag->slug != "migliori")
$tag_link = get_tag_link( $tag->term_id );
$html .= "<li><a href='$tag_link' class='$tag->slug'>";
$html .= "$tag->name</a></li>";
$html .= '</ul>';
echo $html;
This works.
add a comment |
$tags = get_tags();
$html = '<ul>';
foreach ( $tags as $tag )
if($tag->slug != "migliori")
$tag_link = get_tag_link( $tag->term_id );
$html .= "<li><a href='$tag_link' class='$tag->slug'>";
$html .= "$tag->name</a></li>";
$html .= '</ul>';
echo $html;
This works.
add a comment |
$tags = get_tags();
$html = '<ul>';
foreach ( $tags as $tag )
if($tag->slug != "migliori")
$tag_link = get_tag_link( $tag->term_id );
$html .= "<li><a href='$tag_link' class='$tag->slug'>";
$html .= "$tag->name</a></li>";
$html .= '</ul>';
echo $html;
This works.
$tags = get_tags();
$html = '<ul>';
foreach ( $tags as $tag )
if($tag->slug != "migliori")
$tag_link = get_tag_link( $tag->term_id );
$html .= "<li><a href='$tag_link' class='$tag->slug'>";
$html .= "$tag->name</a></li>";
$html .= '</ul>';
echo $html;
This works.
answered Sep 25 '16 at 10:40
maryamarya
4818
4818
add a comment |
add a comment |
I tried this and worked for me.
<?php
$tags = get_tags();
if ($tags)
?><ul class="tags"><?php
foreach ($tags as $tag)
echo '<li><a href="' . get_tag_link( $tag->term_id ) . '"
title="' . sprintf( __( "View all posts in %s" ), $tag-
>name ) . '" ' . '>' . $tag->name.'</a></li>';
echo '<li><a href="#">View All</a><span class="arrow"></span>
</li>'; ?></ul>
<?php ?>
add a comment |
I tried this and worked for me.
<?php
$tags = get_tags();
if ($tags)
?><ul class="tags"><?php
foreach ($tags as $tag)
echo '<li><a href="' . get_tag_link( $tag->term_id ) . '"
title="' . sprintf( __( "View all posts in %s" ), $tag-
>name ) . '" ' . '>' . $tag->name.'</a></li>';
echo '<li><a href="#">View All</a><span class="arrow"></span>
</li>'; ?></ul>
<?php ?>
add a comment |
I tried this and worked for me.
<?php
$tags = get_tags();
if ($tags)
?><ul class="tags"><?php
foreach ($tags as $tag)
echo '<li><a href="' . get_tag_link( $tag->term_id ) . '"
title="' . sprintf( __( "View all posts in %s" ), $tag-
>name ) . '" ' . '>' . $tag->name.'</a></li>';
echo '<li><a href="#">View All</a><span class="arrow"></span>
</li>'; ?></ul>
<?php ?>
I tried this and worked for me.
<?php
$tags = get_tags();
if ($tags)
?><ul class="tags"><?php
foreach ($tags as $tag)
echo '<li><a href="' . get_tag_link( $tag->term_id ) . '"
title="' . sprintf( __( "View all posts in %s" ), $tag-
>name ) . '" ' . '>' . $tag->name.'</a></li>';
echo '<li><a href="#">View All</a><span class="arrow"></span>
</li>'; ?></ul>
<?php ?>
answered Apr 27 '18 at 4:25
Rakhi PrajapatiRakhi Prajapati
3671514
3671514
add a comment |
add a comment |
edit this code and work for me !!!
<ul class="tags">
<?php
$tags = get_tags('post_tag'); //taxonomy=post_tag
//echo "<pre>";
//print_r($tags);
//var_dump($tags);
if ( $tags ) :
foreach ( $tags as $tag ) : ?>
<li><a class="tag" href="<?php echo esc_url( get_tag_link( $tag->term_id ) ); ?>" title="<?php echo esc_attr( $tag->name ); ?>"><?php echo esc_html( $tag->name ); ?></a></li>
<?php endforeach; ?>
<?php endif; ?>
</ul>
Can you add some explanation to this code? To me, it looks like a scrambled copy of other answers
– Nico Haase
Nov 14 '18 at 9:41
But this code show all tags. But i showing particular single post tag listing. can you use this code. <?php the_tags( '<ul class="tags"> <li class="tag">', '</li><li class="tag">', '</li></ul>' ); ?>
– Purnendu Sarkar
Nov 15 '18 at 7:13
add a comment |
edit this code and work for me !!!
<ul class="tags">
<?php
$tags = get_tags('post_tag'); //taxonomy=post_tag
//echo "<pre>";
//print_r($tags);
//var_dump($tags);
if ( $tags ) :
foreach ( $tags as $tag ) : ?>
<li><a class="tag" href="<?php echo esc_url( get_tag_link( $tag->term_id ) ); ?>" title="<?php echo esc_attr( $tag->name ); ?>"><?php echo esc_html( $tag->name ); ?></a></li>
<?php endforeach; ?>
<?php endif; ?>
</ul>
Can you add some explanation to this code? To me, it looks like a scrambled copy of other answers
– Nico Haase
Nov 14 '18 at 9:41
But this code show all tags. But i showing particular single post tag listing. can you use this code. <?php the_tags( '<ul class="tags"> <li class="tag">', '</li><li class="tag">', '</li></ul>' ); ?>
– Purnendu Sarkar
Nov 15 '18 at 7:13
add a comment |
edit this code and work for me !!!
<ul class="tags">
<?php
$tags = get_tags('post_tag'); //taxonomy=post_tag
//echo "<pre>";
//print_r($tags);
//var_dump($tags);
if ( $tags ) :
foreach ( $tags as $tag ) : ?>
<li><a class="tag" href="<?php echo esc_url( get_tag_link( $tag->term_id ) ); ?>" title="<?php echo esc_attr( $tag->name ); ?>"><?php echo esc_html( $tag->name ); ?></a></li>
<?php endforeach; ?>
<?php endif; ?>
</ul>
edit this code and work for me !!!
<ul class="tags">
<?php
$tags = get_tags('post_tag'); //taxonomy=post_tag
//echo "<pre>";
//print_r($tags);
//var_dump($tags);
if ( $tags ) :
foreach ( $tags as $tag ) : ?>
<li><a class="tag" href="<?php echo esc_url( get_tag_link( $tag->term_id ) ); ?>" title="<?php echo esc_attr( $tag->name ); ?>"><?php echo esc_html( $tag->name ); ?></a></li>
<?php endforeach; ?>
<?php endif; ?>
</ul>
edited Nov 14 '18 at 9:40
a_k_v
794112
794112
answered Nov 14 '18 at 8:09
Purnendu SarkarPurnendu Sarkar
12
12
Can you add some explanation to this code? To me, it looks like a scrambled copy of other answers
– Nico Haase
Nov 14 '18 at 9:41
But this code show all tags. But i showing particular single post tag listing. can you use this code. <?php the_tags( '<ul class="tags"> <li class="tag">', '</li><li class="tag">', '</li></ul>' ); ?>
– Purnendu Sarkar
Nov 15 '18 at 7:13
add a comment |
Can you add some explanation to this code? To me, it looks like a scrambled copy of other answers
– Nico Haase
Nov 14 '18 at 9:41
But this code show all tags. But i showing particular single post tag listing. can you use this code. <?php the_tags( '<ul class="tags"> <li class="tag">', '</li><li class="tag">', '</li></ul>' ); ?>
– Purnendu Sarkar
Nov 15 '18 at 7:13
Can you add some explanation to this code? To me, it looks like a scrambled copy of other answers
– Nico Haase
Nov 14 '18 at 9:41
Can you add some explanation to this code? To me, it looks like a scrambled copy of other answers
– Nico Haase
Nov 14 '18 at 9:41
But this code show all tags. But i showing particular single post tag listing. can you use this code. <?php the_tags( '<ul class="tags"> <li class="tag">', '</li><li class="tag">', '</li></ul>' ); ?>
– Purnendu Sarkar
Nov 15 '18 at 7:13
But this code show all tags. But i showing particular single post tag listing. can you use this code. <?php the_tags( '<ul class="tags"> <li class="tag">', '</li><li class="tag">', '</li></ul>' ); ?>
– Purnendu Sarkar
Nov 15 '18 at 7:13
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f39685167%2flist-all-the-tags-in-a-wordpress-blog%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
What code did you try? Did you at least google something like 'Wordpress show all tags'?
– RST
Sep 25 '16 at 9:13
2
Possible duplicate of get all tags of published posts Wordpress
– MarZab
Sep 25 '16 at 9:21