• baal666

    (@baal666)


    Hi,

    I’d like to get a link to a particular #marker somewhere on the page when people are trying to access my previous posts. How can it be done?

    I tried:

    <a href="#marker"><?php next_posts_link('&laquo; Billets pr&eacute;c&eacute;dents') ?></a>

    and

    <?php next_posts_link('<a href="#marker">&laquo; Billets pr&eacute;c&eacute;dents</a>') ?>

    but it was a failure.

    Any idea?

    Thanks

Viewing 10 replies - 1 through 10 (of 10 total)
  • MichaelH

    (@michaelh)

    Could use get_next_posts_link then use str_replace to put that marked in the link the use echo to display the link.

    Also could modify the function get_next_posts_link in wp-includes/link-template.php but modifying core code is discouraged.

    Then again there might be a filter for that but darned if I can see it…

    Thread Starter baal666

    (@baal666)

    Hmmm… I’m kind of a newbie… Any easier way to integrate a # marker?

    MichaelH

    (@michaelh)

    Not unless you can find a plugin.

    Maybe wp-pagenavi has something. https://www.ads-software.com/extend/plugins/wp-pagenavi/

    Thread Starter baal666

    (@baal666)

    I hate plugins; they slow down my blog so much.

    Thread Starter baal666

    (@baal666)

    How would you use str_replace to idenfify a # marker in the next page?

    MichaelH

    (@michaelh)

    Actually get_next_posts_link returns a link such as this:

    <a href="https://sample.com/?paged=3" >&laquo; Older Entries</a>

    So you want to link to look like?

    Thread Starter baal666

    (@baal666)

    Hmmm… Not sure to understand. Whay I need is to relate to the next page but at a particular place in that page, on the place.

    MichaelH

    (@michaelh)

    but at a particular place in that page

    Ah I got you. But, the next page is a series of posts so every next/previous page will have a different set of posts.

    Thread Starter baal666

    (@baal666)

    Yes, I understand that, but I want to put a # marker on them so it will show the right place.

    MichaelH

    (@michaelh)

    Okay, then put the marker in place and type the URL in your browser that goes to that marker then report that URL back here.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘How to add a #marker in php next_posts_link?’ is closed to new replies.