Page 1 of 2

Navigation Previous Next

Posted: Sat Jan 16, 2021 1:09 pm
by RalfKerkhoff
Hi Guys,

i am using a navigation below the article content with the code below.
This works fine when articles are published on the same day.

But if there is a difference in the publishing date which is larger than one day, no prevoious/next articles are displayed.

Example:
Article 1 is published on the 1st of january
Article 2 is published on the 2nd of januar<
Navigation works fine.
Article 3 is pubblished on the 10th of january
No prev/next navigation



Any suggestions to improve the code, that make the navigation work when there are no articles published for example 5 days?


Thanks
Ralf

Code: Select all

<?php


	$previousPageKey = $page->previousKey();
	$previousPage = buildPage($previousPageKey);
	$nextPageKey = $page->nextKey();
	$nextPage = buildPage($nextPageKey);

	echo'<div style="float: right;">';
	echo '<p>Nächster Beitrag: <br/>  ';
	if ($page->nextKey()) {
		echo'&#8729; <a href="'.$nextPage->permalink().'">'.$nextPage->title().'</a>';
		
	} else {
	echo 'Dies ist der letzte Beitrag.';
	}
	echo'</p>';
	echo'</div>';
	echo'<div style="float: left;">';
	echo '<p>Vorheriger Beitrag: <br/> &#8729; ';
	if ($page->previousKey()){
		echo'<a href="'.$previousPage->permalink().'">'.$previousPage->title().'</a>';
		
		} else {
		echo ' Keine weiteren Beiträge.';
	}
	echo'</p>';
	echo'</div>';
	

?>

Re: Navigation Previous Next

Posted: Sat Jan 16, 2021 2:32 pm
by RalfKerkhoff
Whatever is the reason - deleting auto saved items solved the problem.

Re: Navigation Previous Next

Posted: Mon Jan 25, 2021 6:52 pm
by bayerberg
I had the same problem, no other solution than to write previous/ next functionality from scratch.

@diego - can you look into this please? For a while I was sure the issue was with by MAMP installation but looks like others have the same problem

Re: Navigation Previous Next

Posted: Sun Jan 31, 2021 1:13 pm
by diego
Hi,
yes, I'm doing the same, probably some bug.

Check this theme and these lines.
https://github.com/dignajar/gris/blob/m ... hp#L62-L74

I will try to reproduce the issue.

Re: Navigation Previous Next

Posted: Fri Oct 13, 2023 4:02 pm
by RalfKerkhoff
Hi,
are there any news on that?

It is still a problem with the current version of bludit.

cheers
Ralf

Re: Navigation Previous Next

Posted: Fri Oct 13, 2023 9:24 pm
by Edi
RalfKerkhoff wrote: Fri Oct 13, 2023 4:02 pm It is still a problem with the current version of bludit.
Which theme are you using?

Re: Navigation Previous Next

Posted: Sat Oct 14, 2023 11:23 am
by RalfKerkhoff
My fault,
I obviously had a typo when adding the code to the page.php of editorial theme.

Sorry!

Re: Navigation Previous Next

Posted: Mon Oct 16, 2023 6:38 pm
by RalfKerkhoff
Hi Edi,

something is really strange with the navigation.
This article is published today:
https://blog.ralf-kerkhoff.de/bludit

The last article published before is from 13.10.:
https://blog.ralf-kerkhoff.de/experiment-beendet
which has also no navigation links at the bottom.

Difference between articles = 3 days.

Now comes the first strange thing:
Article with published date 11.10.:
https://blog.ralf-kerkhoff.de/wieder-wordpress

has navigation link to the previous article which is from march.
Makes me wonder.

Next strange thing:
Article:
https://blog.ralf-kerkhoff.de/caching-plugins
is from 25.12. and has navigation links to an article from 28.12. (here the 3 days work) and to an article published 1 week before.

Not a dealbreaker but strange.

Re: Navigation Previous Next

Posted: Mon Oct 16, 2023 9:19 pm
by Edi
To see what's the cause of this behaviour I need the theme. You can mail it to me.

Re: Navigation Previous Next

Posted: Tue Oct 17, 2023 5:29 pm
by RalfKerkhoff
Hi,
just sent out the mail with the theme files a few minutes ago.

Thanks for having a look.

Ralf