Navigation Previous Next

User avatar
RalfKerkhoff
Sr. Bludit
Posts: 35
Joined: Sun Jan 03, 2021 11:16 am
Location: Germany
Has thanked: 1 time
Contact:

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>';
	

?>
User avatar
RalfKerkhoff
Sr. Bludit
Posts: 35
Joined: Sun Jan 03, 2021 11:16 am
Location: Germany
Has thanked: 1 time
Contact:

Whatever is the reason - deleting auto saved items solved the problem.
User avatar
bayerberg
Master Bludit
Posts: 141
Joined: Wed Jun 07, 2017 1:05 pm
Location: London, UK
Has thanked: 7 times
Been thanked: 10 times
Contact:

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
bludit plugins and themes - makeitblu | I do things, check them out on behance and dribbble.
User avatar
diego
Site Admin
Posts: 773
Joined: Sat May 16, 2015 2:53 pm
Been thanked: 1 time
Contact:

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.
User avatar
RalfKerkhoff
Sr. Bludit
Posts: 35
Joined: Sun Jan 03, 2021 11:16 am
Location: Germany
Has thanked: 1 time
Contact:

Hi,
are there any news on that?

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

cheers
Ralf
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

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?
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
User avatar
RalfKerkhoff
Sr. Bludit
Posts: 35
Joined: Sun Jan 03, 2021 11:16 am
Location: Germany
Has thanked: 1 time
Contact:

My fault,
I obviously had a typo when adding the code to the page.php of editorial theme.

Sorry!
User avatar
RalfKerkhoff
Sr. Bludit
Posts: 35
Joined: Sun Jan 03, 2021 11:16 am
Location: Germany
Has thanked: 1 time
Contact:

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.
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

To see what's the cause of this behaviour I need the theme. You can mail it to me.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
User avatar
RalfKerkhoff
Sr. Bludit
Posts: 35
Joined: Sun Jan 03, 2021 11:16 am
Location: Germany
Has thanked: 1 time
Contact:

Hi,
just sent out the mail with the theme files a few minutes ago.

Thanks for having a look.

Ralf
Post Reply