• Howdy good folks, hope I am posting this is the right section.

    What I would like to do is have a dynamic link to the first post in a category — so when you click into say the ‘Site News’ category where the links for ‘Next page’ and ‘Previous page’ are there would also be a link for ‘First page’.

    Is this possible with either a bit of code or a plugin? I’ve searched and searched but not been able to come up with any thing myself.

    Any help would be appreciated ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • I’m trying to figure this out, too. Did you find a solution?

    Not sure if this is the right way, but it was a way that worked for me to create a link back to the first post of a category:

    at the top of the particular page of interest I created this block:

    <?php
    $cat = 0;
    $p_count = 0;
    $cat_start_link = ”;
    foreach((get_the_category()) as $category) {
    $cat = $category->cat_ID;
    $p_count = ($category->count);

    // combine to get the final link with cat=#&paged=#
    $cat_start_link = get_category_link($cat) . ‘&paged=’ . $p_count;
    }
    ?>

    Then down in the content I created a link something along these lines (styled of course):

    “>First Post!

    Hm it deleted the last part… lets try that again:

    <a href="<?php echo $cat_start_link ?>">First Post!</a>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘First page in category’ is closed to new replies.