Tagged: navigation, next, post navigation, previous
-
AuthorPosts
-
January 10, 2015 at 12:59 pm #377761
Hi All,
Please have a look at this page: http://www.paciorkiewicz.pl/2015/01/childhood/
This is one of the posts in the category: Biography.
If you hover your mouse pointer to the left or right of the screen there is an animated prev/next post arrow.
They point to previous or next posts in the blog roll.
Can this be only limited to one category in this case – Biography?regards,
PeterJanuary 10, 2015 at 5:50 pm #377794Hey TheElear!
Please add following code to Functions.php file in Appearance > Editor
add_filter( 'avia_post_nav_settings', 'enfold_customization_same_cat' ); function enfold_customization_same_cat( $s ) { $s['same_category'] = true; return $s; }
Cheers!
YigitJanuary 11, 2015 at 11:00 am #377944Hi Yigit,
Many thanks for that. I will add it to functions.php in enfold-child.
I have another question regarding post navigation. I have categories of posts (compositions) on the website. If you go to one of them here:
http://www.paciorkiewicz.pl/compositions/orchestral-works/ you will see that they are sorted by slug as per your instructions in this thread: https://kriesi.at/support/topic/custom-sorting-of-blog-posts-in-avia-builder/
However when you click lets say on the third post on the list (Concertino for …) and then check what the prev/next post navigation is showing you – this is different what is on the list of this category. So on the list you have this order:
– Andante lirico (2) / Concertino for Bassoon and Wind Band (3) / Concerto Alla Barocco (4)
When you click on the Concertino for Bassoon and Wind Band:
– the prev navigation is showing Adagio and Allegro (instead of Andante lirico)
– the next navigation is showing Allegro for Clarinet and Horn (instead of Concerto Alla Barocco)I believe this is because the sort order of the posts in this category is customized by slug, whereas prev/nxt navigation is showing posts by date they were originally added?
My question is can prev/next post navigation show posts in the same order as they are showed in the category view?
Or if I search for a term ‘flute’ can the prev/next post navigation show posts only for the search results list?Many thanks,
TheElear- This reply was modified 9 years, 11 months ago by TheElear.
January 13, 2015 at 3:11 am #378626Hi!
please see this: http://kriesi.at/documentation/enfold/how-to-add-an-orderorderby-option-to-the-blogpost-sliderportfoliomasonry-grid-element/
Best regards,
AndyJanuary 13, 2015 at 12:39 pm #378736Hi Andy,
Many thanks for this link. I have alredy set up custom sorting of posts.
My question is not about custom order of posts it is about next/prev navigation of posts.
When you have custom order of posts I would also like the next/prev navigation to reflect that.At the moment you can set up custom order of posts BUT the next/prev navigation has original ‘date added’ order.
Same with post search results. If my search has 10 posts, you would expect next/prev navigation to navigate within this 10 posts. Currently it navigates through the whole blog roll
regards,
PJanuary 15, 2015 at 9:59 pm #380482Hi!
I don’t see an easy way of going about that unfortunately. It’s going to take a lot of time and code to make it work like how your wanting so it would have to be considered custom work. It would be best to hire a freelancer to help you out with this customization.
Regards,
ElliottJanuary 21, 2015 at 7:39 pm #383289Hi All,
This is not a new problem/need as illustrated by links below (although not resolved):
1. http://wordpress.stackexchange.com/questions/73190/can-the-next-prev-post-links-be-ordered-by-menu-order-or-by-a-meta-key
2. https://wordpress.org/plugins/ambrosite-nextprevious-post-link-plus/
3. http://forum.bytesforall.com/showthread.php?t=4914I think Enfold is one of the best themes for WP and such feature would only make it stand out from the crowd even more!
I understand that putting this code together may take some time. I just hope that since Yigit has already did some code to limit next/prev post navigation to the current category, that sorting the next/prev navigation to be the same like ‘order by’ of this category should not be that difficult.
Please let me know if this can be done.To me this feature is simply logical consequence of browsing posts within one category. Especially that feature images are shown on the next/prev navigation (and they are currently different to feature images seen in the category view because of different sorting).
I am therefore convinced that this is going to be very much desired enhancement to Enfold theme and the hours spent developing it will not be wasted.I also think that employing external developer to deliver this feature is a waste of time and effort. I think this should be done by the Enfold team who know this theme throughout and will nicely integrate it into the Enfold for the benefit of other users (and my) and make the best theme for WordPress even better.
If you cannot come up with this code within this support forum, I will be more than happy to consider hiring Enfold team to do it. Please let me know how many hours you would need and at what rate. Perhaps I could sponsor this feature at least in some part.
Please let me know if you can come up with this code, what are the options and what you think?
kind regards,
PeterJanuary 25, 2015 at 7:09 pm #385158Hey!
thanks for your update.
What you want to achieve is out of our support scope. On envato.com or werkpress.com you will find excellent developers who can do what you want with Enfold.Feel free to make a feature request for Kriesi here: kriesi.at/support/enfold-feature-requests/
Regards,
AndyMarch 26, 2015 at 11:45 pm #418909I have a custom post type and I was wanting the same thing TheElear wanted in terms of keeping people using the side navigation prev/next to stay in the same category. When I implement the code provided by Yigit, the side navigation stops working entirely. Is there something different I should be trying since it’s a custom post type?
March 27, 2015 at 1:44 pm #419246Hey!
Did you add any unique taxonomies to the custom post type?
add_filter( 'avia_post_nav_settings', 'enfold_customization_same_cat' ); function enfold_customization_same_cat( $s ) { $s['same_category'] = true; $s['taxonomy'] = 'TAXONOMY NAME HERE'; return $s; }
You should also add a conditional function.
add_filter( 'avia_post_nav_settings', 'enfold_customization_same_cat' ); function enfold_customization_same_cat( $s ) { if(singular('POST TYPE NAME HERE')) { $s['same_category'] = true; $s['taxonomy'] = 'TAXONOMY NAME HERE'; } return $s; }
Best regards,
IsmaelMarch 27, 2015 at 8:53 pm #419606Hi Ismael!
This didn’t work for me either. We’re trying to query posts by taxonomy and tagID (which represents the custom categories in that taxonomy). Does that change anything?
I really appreciate your support.
March 29, 2015 at 4:06 pm #419986Hey!
Are you sure that you used the correct taxonomy and post type name? Did you use a plugin to create the custom post type? Please open a new thread and post the login details there. We would like to check it.
Cheers!
IsmaelDecember 2, 2018 at 4:19 am #1039763Hi @Yigit,
as per your code
add_filter( ‘avia_post_nav_settings’, ‘enfold_customization_same_cat’ );
function enfold_customization_same_cat( $s ) {
$s[‘same_category’] = true;
return $s;
}
do I somewhere have to specify the category name? I have disabled the arrows by default with below code:
/*Disable previous and next post arrows on posts*/
#top .avia-post-nav { display: none; }
…as I am using many post categories with masonry galleries….but want to enable them just on one category (latest news).
Can you please assist?
Thank you,
Vasilis- This reply was modified 6 years ago by Vasilis.
December 3, 2018 at 5:02 am #1040101Hi,
You can wrap the “same_category” parameter inside a conditional function like is_category or is_tax.
// https://developer.wordpress.org/reference/functions/is_tax/
// https://developer.wordpress.org/reference/functions/is_category/Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.