mirror of
https://github.com/cupcakearmy/liquet.git
synced 2024-12-23 00:26:25 +00:00
reusable tags snippets
This commit is contained in:
parent
db1aa0d0d8
commit
967d0ef870
@ -1,9 +0,0 @@
|
|||||||
<?php
|
|
||||||
$tags = get_the_tags();
|
|
||||||
if ($tags) { ?>
|
|
||||||
<div class="tags">
|
|
||||||
<?php foreach ($tags as $tag) { ?>
|
|
||||||
<a class="tag" href="<?= get_tag_link($tag->term_id); ?>"><?= $tag->name; ?></a>
|
|
||||||
<?php } ?>
|
|
||||||
</div>
|
|
||||||
<?php }
|
|
25
liquet/tags.php
Normal file
25
liquet/tags.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
function render_all_tags() {
|
||||||
|
$tags = get_tags( [ 'orderby' => 'count', 'order' => 'desc' ] );
|
||||||
|
|
||||||
|
if ( $tags ) { ?>
|
||||||
|
<div class="tags">
|
||||||
|
<?php foreach ( $tags as $tag ) { ?>
|
||||||
|
<a class="tag" href="<?= get_tag_link( $tag->term_id ); ?>"><?= $tag->name; ?>
|
||||||
|
<b><?= $tag->count ?></b></a>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
<?php }
|
||||||
|
}
|
||||||
|
|
||||||
|
function render_current_tags() {
|
||||||
|
$tags = get_the_tags();
|
||||||
|
if ( $tags ) { ?>
|
||||||
|
<div class="tags">
|
||||||
|
<?php foreach ( $tags as $tag ) { ?>
|
||||||
|
<a class="tag" href="<?= get_tag_link( $tag->term_id ); ?>"><?= $tag->name; ?></a>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
<?php }
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user