• Is it possible to do something like this
    get_permalink($category_ID=’some_id’)

    And to post just 1st of them πŸ™‚

Viewing 1 replies (of 1 total)
  • No. get_permalink() only accept a post’s or Page’s ID. It doesn’t parse anything else. There’s a get_category_link() which accepts a category’s ID, but it outputs the url for the category, not the posts in it.

    If you’re trying to get the latest post in a category, there are a number of ways to go about it, but here’s one using WP_Query that should work for you:

    <?php $my_query = new WP_Query('cat=1&showposts=1'); ?>
    <?php $my_query->the_post(); ?>
    <?php echo get_permalink(); ?>

Viewing 1 replies (of 1 total)
  • The topic ‘get_permalink()’ is closed to new replies.