WordPress.org

Ready to get started?Download WordPress

Forums

Post Tags and Categories for Pages
[resolved] display the page tags? (5 posts)

  1. jeponkz
    Member
    Posted 1 year ago #

    How can I display the page tags?

    I am able to display post tags using the following code

    function wp_get_all_tags( $args = '' ) {

    $tags = get_terms('post_tag');
    foreach ( $tags as $key => $tag ) {
    if ( 'edit' == 'view' )
    $link = get_edit_tag_link( $tag->term_id, 'post_tag' );
    else
    $link = get_term_link( intval($tag->term_id), 'post_tag' );
    if ( is_wp_error( $link ) )
    return false;

    $tags[ $key ]->link = $link;
    $tags[ $key ]->id = $tag->term_id;
    $tags[ $key ]->name = $tag->name;
    echo ' ' . $tag->name . '';
    }
    return $tags;
    }

    function get_tag_slug($title) {
    global $wpdb;
    $slug = $wpdb->get_var("SELECT slug FROM $wpdb->terms WHERE name='$title'");
    return $slug;
    }

    but I am not able to display page tags. any idea?

    http://wordpress.org/extend/plugins/post-tags-and-categories-for-pages/

  2. curtismchale
    Member
    Plugin Author

    Posted 1 year ago #

    Not sure why you wrote all that code instead of using the_tags. I just took a look through WordPress core code and the_tags calls get_the_tags_list which calls get_the_term_list.

    None of those functions make any distinction for post types so I'd guess that you can just use the_tags.

    http://wpseek.com/the_tags/
    http://wpseek.com/get_the_tag_list/
    http://wpseek.com/get_the_term_list/

  3. curtismchale
    Member
    Plugin Author

    Posted 1 year ago #

    Just wanted to double check that this solved your issue.

  4. jeponkz
    Member
    Posted 1 year ago #

    hello curtis, sorry for my late response because I was in vacation. First of all I want to thank you for your help. I was able to solve the problem thanks to the links that you have given. Thank you again..

  5. curtismchale
    Member
    Plugin Author

    Posted 1 year ago #

    Sorry? Nah, I was just making sure that things were good.

    Have a great new year.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.