Wednesday, May 16, 2012

Get Category Details In Wordpress

How can we get the category details in Wp Blog.


<?php get_category_link$category_id ); ?>


If you want to get the category links



<?php
    // Get the ID of a given category
    $category_id = get_cat_ID( 'Category Name' );

    // Get the URL of this category
    $category_link = get_category_link( $category_id );
?>

<!-- Print a link to this category -->
<a href="<?php echo esc_url( $category_link ); ?>" title="Category Name">Category Name</a>

separator (string) Text or character to display between each category link. The default is to place the links in an unordered list. parents (string) How to display links that reside in child (sub) categories. Options are: 'multiple' - Display separate links to parent and child categories, exhibiting "parent/child" relationship. 'single' - Display link to child category only, with link text exhibiting "parent/child" relationship. Note: Default is a link to the child category, with no relationship exhibited. post_id (Integer) Post ID to retrieve categories. The default value is false (the current post). This usage lists categories with a space as the separator.
<p>Categories: <?php the_category(' '); ?></p>
Separated by Comma Displays links to categories, each category separated by a comma (if more than one).
<p>This post is in: <?php the_category(', '); ?></p>
Separated by Arrow Displays links to categories with an arrow (>) separating the categories. (Note: Take care when using this, since some viewers may interpret a category following a > as a subcategory of the one preceding it.)
<p>Categories: <?php the_category(' &gt; '); ?></p>
Separated by a Bullet Displays links to categories with a bullet (•) separating the categories.
<p>Post Categories: <?php the_category(' &bull; '); ?></p>

By PHP with No comments

0 comments:

Post a Comment

    • Popular
    • Categories
    • Archives