[resolved] Link to premalink_anchor (2 posts)

  1. ABoooo
    Posted 3 years ago #


    in my arcive page I have created a permalink anchor before the title. Now I would like to link to posts from my front page as "read more" - how can I do this except writing actual id and that is something I don't want to do. I would like this links to be dynamic.

    This is my code:

    <?php while (have_posts()) : the_post(); ?>
    <div id="onenews">
    <span class="date"><?php echo get_the_date(); ?></span>
    $string = get_the_content();
    $newString = substr($string, 0, 100);
    echo $newString;
    <!-- This is where I call may Archive page and I'm also trying to add an anchor id -->
    <a>/?page_id=225#<?php permalink_anchor(); ?>">Read more...</a>
    <?php endwhile; ?>

    Any help would be appreciated. Thanks

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code may now have been permanently damaged/corrupted by the forum's parser.]

  2. ABoooo
    Posted 3 years ago #

    my link looks like this now

    /?page_id=225#post-<?php the_ID(); ?>">

Topic Closed

This topic has been closed to new replies.

About this Topic