Support » Fixing WordPress » Linking to paged categories with html anchor Name attribute

  • I have two categories: 29 and 33. Every post is in category 33, but only some of them are in category 29. I organized the posts this way so that I can have selective posts on my index.php using:

    <?php if (in_category('29')) continue; ?>

    And every post on the category page for category 33. I don’t want to use the single.php. Instead, I’m trying to set up the post titles on the index.php to link to the same post on the category 33 page. I’m trying to link to the specific position in the category 33 page using the post’s date as an HTML anchor:

    <a href="<?php echo get_category_link(33);?>#<?php the_time('n.j.Y'); ?>" rel="bookmark" title="Link to this post on the Cat 33 Page <?php the_time('l.F j.Y'); ?>">
    <?php the_title(); ?>

    The above code turns the post title into a link to:


    And then on the category 33 page, the title is called within the anchor tag:

    <a name="<?php the_time('n.j.Y'); ?>">
    <?php the_title(); ?>

    This works for the first few posts on the index.php, but as soon as the category posts become paged, the links no longer work. How do I find out where each post in category 33 is paged? And is there a simpler way of linking a post on the index.php to the same post on the category.php? Thanks so much :>

  • The topic ‘Linking to paged categories with html anchor Name attribute’ is closed to new replies.