- This topic has 6 replies, 2 voices, and was last updated 7 years, 5 months ago by dasigna.
-
AuthorPosts
-
November 3, 2016 at 4:57 am #241333dasigna
hi tom,
great help already on this post making cpts behave as normal posts with next/prev-links. works flawlessly
but now there is a new upcoming question:
can one make that an infinite loop – so that when reached the last post in single view there will still be some link to the next cpt (in that case the first again) and vice versa???the thing is, that when starting to view one post ‘in the middle’ of the post list you wont get to view all by ‘scrolling’ just to one direction … get what i mean?
have already tried out inserting various snipplets found in depth of the web, but they do not seem to work as intended or maybe interfere in some way with the code given i the above link (this one).
any help possible to solve/achieve this?
thanks in advance.
November 3, 2016 at 10:33 am #241427TomLead DeveloperLead DeveloperIt looks like it’s possible, but requires custom code: https://gist.github.com/banago/5603826
You would need to overwrite the
generate_content_nav()
function found in template-tags.php.Specifically you would need to replace anywhere the
previous_post_link()
andnext_post_link()
functions are called.November 3, 2016 at 12:46 pm #241473dasignafeared an answer like this …
It looks like itβs possible, but requires custom code: https://gist.github.com/banago/5603826
… one of those i’ve tried – but didnt work π
where to put this thing exactly? functions.php?before again running into trouble: any more detailed hints possible?? (not that hero of coding…!)
You would need to overwrite the generate_content_nav() function found in template-tags.php.
… found in ‘/gp/inc’ ? that thing is big. what to replace with what else? …
copy, edit and put into child? seems tricky regarding updates.Specifically you would need to replace anywhere the previous_post_link() and next_post_link() functions are called.
… again, same question … π
location must be hopefully only in this area<?php if ( is_single() ) : // navigation links for single posts ?>
??kinda standing on shaky ground for me – sounds as if i should keep my hands off of that… π
no detailed tut for this???
November 3, 2016 at 3:32 pm #241513TomLead DeveloperLead DeveloperIt’s definitely not an easy thing you’re getting yourself into π
First, copy this entire function (generate_content_nav) and add it to your child theme/custom plugin: https://github.com/tomusborne/GeneratePress/blob/1.3.40/inc/template-tags.php#L57-L108
Then, replace these two lines with the code in that post: https://github.com/tomusborne/GeneratePress/blob/1.3.40/inc/template-tags.php#L87-L88
November 4, 2016 at 4:40 am #241616dasigna… youre getting lots of requests – have to search the thread again …
so for the current case:
got it implemented and worked somehow – infinite is there in priciple πbut ten two things occur:
1. having to define two different cpts for looping separately wich does not work really well…
always get issues either with looping trough both cpts at once or getting stuck at first or last cpt of one kind.
2. the formatting and display of the post title is gone with the tweak, so i thought it would be some good idea to put in the link calls from you. again works partially but causes some issues with the echo on frontend: loosing links, title not showing…so for the moment i am pausing the thing after spending some hours on it. by now seems nearly inachieveable with my weak knowledges. maybe theres one that might take a look on it… π
would be a great thing but turns out to be really hard.
(why cant coding be drag’n drop too??? …!)many thanks for the moment – myself has to take some break for now!
November 4, 2016 at 10:58 am #241743TomLead DeveloperLead DeveloperIt’s been a busy month so far in the forum π
If I find a little time I’ll try to implement it myself to see if I can help with more code in here. It’s definitely a difficult thing to do – I’m surprised there isn’t a built in filter in WordPress to handle it, as it’s actually a good idea.
November 5, 2016 at 7:44 am #241938dasignayeah, wondering too why this is an native option within WP… even more since the call seems to be there already.
anyway, cant get it to work the way intended right now.
if youre interested and got the time it would be great!! might provide you with a link to the site released these days with the demand for that – prework still in custom functions.php but commented out.let me know π
-
AuthorPosts
- You must be logged in to reply to this topic.