Last active
January 1, 2016 20:14
-
-
Save sxidsvit/9852765ca182d45cb697 to your computer and use it in GitHub Desktop.
Получим ID категории, передав функции её слаг
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Получим ID категории, передав функции её слаг */ | |
<?php $idObj = get_category_by_slug('s_about'); $id = $idObj->term_id; echo get_cat_name($id); ?> | |
/* Выводим описание категории */ | |
<?php echo category_description($id); ?> | |
/* Выводим описание категории по тегу */ | |
<?php | |
$tags = get_tags(); | |
if ($tags) { | |
foreach ($tags as $tag) { | |
echo '<p>Tag: <a href="' . get_tag_link( $tag->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $tag->name ) . '" ' . '>' . $tag->name.'</a> </p> '; | |
} | |
} | |
?> | |
<?php | |
$tags = wp_get_post_tags($post->ID); | |
if ($tags) { | |
foreach($tags as $tag) { | |
echo '<p>' . $title . '<a href="' . get_term_link( $tag, 'post_tag' ) . '" title="' . sprintf( __( "View all posts in %s" ), $tag->name ) . '" ' . '>' . $tag->name.'</a> has ' . $tag->count . ' post(s). </p> '; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment