WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] post_permalink not working? [Category Page] (2 posts)

  1. buskerdog
    Member
    Posted 4 years ago #

    I'm hacking the Category Page plugin (page2cat) to display excerpts and titles to a host of posts at the bottom of each page, but I don't think my problem is specific to the plugin. I'm having trouble getting the link to the posts to appear. I wrote this:

    $catposts = get_posts('category='.$v0."&numberposts=".$limit);
    foreach($catposts as $single):
    $output .= "<div class='menu_class'>";
    $output .= "<a href='";
    $output .= $single->post_permalink;
    $output .= "'>";
    $output .= $single->post_title;
    $output .= $single->post_excerpt;
    $output .= "</a></div>";
    endforeach;

    post_title and post_excerpt return like champs but post_permalink returns nothing. I also tried to fake it by doing something with post_ID instead but that also returns nothing. Can we not pull post_permalink out with the same method as that other stuff?

  2. buskerdog
    Member
    Posted 4 years ago #

    Never mind, this did it:

    get_permalink($single->ID)

Topic Closed

This topic has been closed to new replies.

About this Topic