WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Link to premalink_anchor

[Resolved] Link to premalink_anchor

  • ABoooo
    Participant

    @aboooo

    Hi,

    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>
    <p>
    <?php
    $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>
    </p>
    </div>
    <?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.]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Link to premalink_anchor’ is closed to new replies.