• Hi All,

    This seems like a silly question to ask and it seems as if there would/should be an answer to it somewhere already. However, I have now spent 2+ hours banging my head against my keyboard trying in vain to create a text link (‘View More Posts’) in my sidebar under individual site categories to point to that specific Category’s postbypost archive.

    You can see my layout/test site here: http://www.test.theweekendhousewife.com

    See the ‘view more posts’ links in the Sidebar. (I know they may be hard to see as they are a light pink – still working on that.)

    Is it possible to have a text link point to individual Category archive pages/templates? I have tried wp_get_category, I have tried to echo wp_get_category, I have seemingly tried EVERYTHING I could find in the Codex and through Google relating to Category pages, but nothing seems to do exactly what I am trying to accomplish. I was able to do it with the general Archives Template for ALL posts (see bottom of Main page content – View More Posts). but can not specify just individual categories from the text links I have.

    On a slightly different note, (but still on same topic), how can I DYNAMICALLY input the Category names in the ‘View more posts’ link’s title attribute to display ‘tooltip’ that will read: “View more posts in the [CATEGORY NAME] Category”? Is it possible? None of the info I found in the Codex seemed to do this.

    Hope this makes sense. I’ve been working for 6 hours and it is now 4:30a and I am frustrated that this seemingly simple functionality eludes me.

    Thanks for any advice in advance.

    Craig

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    Thread Starter Craig0678

    (@craig0678)

    Thanks @keesiemeijer! I had already tried that with no luck. I tried it again and IT WORKED! I am guessing I must have entered the incorrect Category name in when I tested the top link. PEBKAC I guess 🙁

    Any suggestions how to make the title attribute DYNAMIC so if Category names are changed by User, the title attributes will update without User needing to edit code?

    Thanks so much.

    Thread Starter Craig0678

    (@craig0678)

    New problem…Now the Category Archive I was trying to link to shows multiple instances of the first post in that Category only. Any idea where this issue may lie? I assume it is in the Loop somewhere, but not sure what I did wrong.

    What code would I need to show to get help? Should I post a new topic?

    Thanks Craig

    Moderator keesiemeijer

    (@keesiemeijer)

    Any suggestions how to make the title attribute DYNAMIC so if Category names are changed by User, the title attributes will update without User needing to edit code?

    Try it with this:

    <?php
      $cat_name = get_cat_name( 25 );
      $cat_link = get_category_link( 25 );
    ?>
      <a href="<?php echo esc_url($cat_link); ?>" title="View more posts from the <?php echo esc_attr(strip_tags($cat_name)); ?> category"><?php echo $cat_name; ?></a>

    Can you paste and submit the full code of category.php or archive.php of your theme into a pastebin.com and post the link to it here? see the Forum Rules for posting code and using the pastebin.

    try:
    – deactivating all plugins to see if this resolves the problem? If this works, re-activate the plugins one by one until you find the problematic plugin(s).

    – switching to the default theme to rule out any theme-specific problems.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Create "View More Posts" Link for Category Archives’ is closed to new replies.