Forums

[resolved] Problem with next_posts_link and own domain (3 posts)

  1. marcbauer84
    Member
    Posted 2 years ago #

    Hi everyone!

    I have a problem with my blog, installed here: http://alpha2k.ice-server.com/marcbauer/wordpress but mapped with the following domain: http://marc-bauer.com

    The next_posts_link doesn't work on the main page nor the archives. All other links however work (to posts, inside a post to the previous one, to pages, etc.)

    When I click on the next_posts_link generates the following: http://marc-bauer.com/marcbauer/wordpress/?paged=2 allthough it should be http://marc-bauer.com/?paged=2
    So it takes some structure from it's installation place into its URL. Why is that?

    The link is implemented like this (also on other standard themes):
    <div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">&laquo;</span>', 'sandbox')) ?></div>

    Please help me, I'm going crazy about this error.

  2. marcbauer84
    Member
    Posted 2 years ago #

    Well, okay, a friend helped me to find a workaround.
    We edited the wp-includes/link-template.php and made a preg_replace at the point where it generates the wrong path.

    function next_posts( $max_page = 0, $echo = true ) {
    	$output = esc_url( get_next_posts_page_link( $max_page ) );
    	$output = str_replace('marcbauer/wordpress/','' , $output);

    It works!
    Although it doesn't solve the underlying problem of generating the wrong path in the first place. But I'm fine with this.

  3. aponeurotica
    Member
    Posted 2 years ago #

    This is EXACTLY what I am struggling with at the moment.
    I have custom templates to filter post categories to specific pages:
    http://www.ancestralknowledge.org/?page_id=712

    The first page displays fine, but if you try to navigate to older posts it mixes categories and date stamps.

    Did you put the above workaround in the template.php or in the functions.php? Can you possibly include a snippet of code appearing before and after your fix so I have an idea of where you plugged it in?

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic