-
AuthorPosts
-
September 13, 2015 at 11:14 am #502279
Hi Guys,
I was wondering if it’s possible to have the next/prev buttons of the portfolio inside the page? Maybe there is a function that can be called from a codeblock or something? Since we have about 70 portfolio items linking manually is not an option.
If there’s a way to do this, the default arrows have to be hidden.
I’d be great if someone can point me in the right direction (not a star at PHP)
Kind regards!
- This topic was modified 9 years, 2 months ago by lucasvrooij.
September 13, 2015 at 3:21 pm #502322Hey lucasvrooij!
So the next / prev buttons used to cycle through the portfolio posts, your trying to place them inside the page content instead of hovering on the sides?
You would have to add them manually, https://codex.wordpress.org/Function_Reference/previous_post_link.
Probably in the /enfold/includes/loop-portfolio-single.php file around line 51.
Best regards,
ElliottSeptember 21, 2015 at 12:13 pm #506362Hello Elliott,
Thanks for you reply.
I expected your reference to de wp codex to completely solve my problem (didn’t even know it was a core wp function). But unfortunantly the buttons won’t show up. When i insert things like <?php next_post_link(); ?> or <?php next_post_link( ‘%link’, ‘Next post in category’, TRUE ); ?> the buttons don’t show up in the page.
I inserted a codeblock in the pagebuilder, maybe this is the problem? Also might have something to do with the fact that the button’s are already shown as floating buttons?
Kind regards,
Lucas van RooijSeptember 21, 2015 at 6:03 pm #506577Hey!
You cannot add PHP in the dashboard (unless using a plugin such as PHPExec). You will need to edit the file mentioned in my previous post.
Cheers!
ElliottSeptember 21, 2015 at 6:39 pm #506605Hi Elliott,
Thanks again for responding quickly.
I forgot to mention i had also tried adding the php to the file you mentioned. The code now looks like this:
<?php do_action(‘ava_after_content’, get_the_ID(), ‘single-portfolio’); ?>
<?php previous_post_link(); ?>
</article><!–end post-entry–><?php
$post_loop_count++;
endwhile;
else:
?>But still the button doesn’t show up in my portfolio item. I tried multiple places in the file that seemed plausible to me, are you sure this is the right file to add the code in?
Kind regards.
Kinds regafrds
September 22, 2015 at 3:46 pm #507141Hey!
It’s working fine on my end. Add the “next_post_link()” in there as well. Send us a WordPress login if your still having trouble.
Regards,
ElliottSeptember 28, 2015 at 12:35 pm #510004Hi Elliott,
I tried:
<?php previous_post_link();?>
<?php previous_post_link();?><?php next_post_link();?>
<?php previous_post_link(); next_post_link();?>But non of these showed anything.
Below i added wp and ftp acces, i’d be great if you can take a look.
Thanks in advance!
September 28, 2015 at 5:17 pm #510298Hey!
Well, since your using the layout builder I had to do something else. I added this to the bottom of your functions.php file.
add_filter( 'avf_template_builder_content', 'enfold_customization_portfolio_next' ); function enfold_customization_portfolio_next( $content ) { if ( is_singular('portfolio') ) { $content .= '<div style = "clear:both;"></div>'; $content .= get_previous_post_link(); $content .= get_next_post_link(); return $content; } }
Cheers!
ElliottOctober 1, 2015 at 8:56 am #512004Hi Elliott,
Thanks for your effort but the code caused all blank pages. I recovered the original functions.php and the site worked again, i saved the file you edited as functions_elliott.php in the original folder.
I don’t have the knowledge to see what went wrong with the code you used, i’d appreciate if you could take another look.
Kind regards.
October 1, 2015 at 7:43 pm #512387Hey!
Not sure what you mean by blank white pages. Perhaps you thought I meant to add it in? If you added it in again then that would have caused a duplicate function error hence white pages.
I added the code back into your functions.php file and it’s working fine like it was on the 28th.
Best regards,
Elliott- This reply was modified 9 years, 1 month ago by Elliott.
October 2, 2015 at 11:31 am #512693Hi Elliott,
I discovered what’s going on, the portfolio entries show up (with prev/next buttons) but normal pages show a blank content section.
I added links to normal page and project page below.
October 2, 2015 at 7:50 pm #512994Hi!
Pages do not get next / previous links because they are not posts. If your trying to add them to pages then your going to have to hire a freelancer.
Best regards,
ElliottOctober 2, 2015 at 7:56 pm #512998Elliott,
Because i had to do some work on the website, i recovered the original functions.php so the site worked fine when you checked.
Your functions.php is now enabled, please click the links from my previous post, you will see the problem.
October 2, 2015 at 8:19 pm #513013Hi!
I already checked them and like I said.. pages do not get next / previous links because they are not posts. Take a screenshot and highlight what your trying to do so we can get a better idea.
Regards,
ElliottOctober 2, 2015 at 9:16 pm #513037Elliott,
I uploaded a short video to show you the problem.
Kind regards.
October 5, 2015 at 10:16 am #513582Hey!
thanks for the video and as Elliott already said it won’t be possible to achieve what you want with basic support which we can offer you here in this support forum (as written in our support policy). You need to hire a freelancer for this job, as it would require a huge amount of time and customization of the theme. You can find a good freelancer for example here: http://kriesi.at/contact/customization
Best regards,
AndyOctober 26, 2016 at 12:58 pm #704247Hi there,
i’d like to add some clarification and another question here. I also want some text based buttons for prev / next portfolio items.
i added this code to my child-theme function.phpadd_filter( 'avf_template_builder_content', 'enfold_customization_portfolio_next' ); function enfold_customization_portfolio_next( $content ) { if ( is_singular( 'portfolio' ) ) { $content .= '<div class = "oha-portfoliobuttons"><ul><li>'; $content .= get_previous_post_link( '%link' ); $content .= '</li><li>'; $content .= get_next_post_link('%link'); $content .= '</li></ul></div>'; return $content; } }
and it works as wanted on single portfolio pages
BUT
removes all content from other parts of the website.
The main menu is still there, but no other page is visible.
(this might be what lucasvrooij meant with “blank pages” here https://kriesi.at/support/topic/portfolio-nextprev-buttons-in-page/#post-512693 )
So maybe something in this
if ( is_singular( 'portfolio' ) )
is not properly working?Best,
PhilippOctober 26, 2016 at 5:34 pm #704453Never mind, found out myself what was going on (not really understanding it though): adding an
else
statement at the end did the trick!add_filter( 'avf_template_builder_content', 'enfold_customization_portfolio_next' ); function enfold_customization_portfolio_next( $content ) { if ( is_singular( 'portfolio' ) ) { $content .= '<div class = "oha-portfoliobuttons"><ul><li>'; $content .= get_previous_post_link( '%link' ); $content .= '</li><li>'; $content .= get_next_post_link('%link'); $content .= '</li></ul></div>'; return $content; } else { return $content; } }
October 31, 2016 at 5:08 am #705954Hi,
Glad that you fixed it. The code above works when you added the else statement is because the else part tells if it’s not a portfolio post then just use the original content unlike the code that has no else statement which doesn’t return any content that’s why it’s just a blank content that is displayed. Hope my explanation is clear :)
Best regards,
NikkoJanuary 12, 2018 at 2:14 pm #896589It works for me (with te theme styling). Add it in functions.php
/*************************************/ add_filter( 'avf_template_builder_content', 'enfold_customization_portfolio_nextprev' ); function enfold_customization_portfolio_nextprev( $content ) { global $wp_version; $settings = array(); $settings['same_category'] = 'true'; $settings['excluded_terms'] = ''; $settings['wpversion'] = $wp_version; $settings['type'] = get_post_type(); $settings['taxonomy'] = ($settings['type'] == 'portfolio') ? 'portfolio_entries' : $taxonomy; if(version_compare($settings['wpversion'], '3.8', '>=' )) { $entries['prev'] = get_previous_post($settings['same_category'], $settings['excluded_terms'], $settings['taxonomy']); $entries['next'] = get_next_post($settings['same_category'], $settings['excluded_terms'], $settings['taxonomy']); } else { $entries['prev'] = get_previous_post($settings['same_category']); $entries['next'] = get_next_post($settings['same_category']); } $entries = apply_filters('avia_post_nav_entries', $entries, $settings); $output = ""; if ( is_singular( 'portfolio' ) ) { $entries = apply_filters('avia_post_nav_entries', $entries, $settings); foreach ($entries as $key => $entry) { if(empty($entry)) continue; $the_title = isset($entry->av_custom_title) ? $entry->av_custom_title : avia_backend_truncate(get_the_title($entry->ID),75," "); $link = isset($entry->av_custom_link) ? $entry->av_custom_link : get_permalink($entry->ID); $image = isset($entry->av_custom_image) ? $entry->av_custom_image : get_the_post_thumbnail($entry->ID, 'thumbnail'); $tc1 = $tc2 = ""; $class = $image ? "with-image" : "without-image"; $content .= "<a class='avia-post-nav avia-post-{$key} {$class}' href='{$link}' >"; $content .= " <span class='label iconfont' ".av_icon_string($key)."></span>"; $content .= " <span class='entry-info-wrap'>"; $content .= " <span class='entry-info'>"; $tc1 = " <span class='entry-title'>{$the_title}</span>"; if($image) $tc2 = " <span class='entry-image'>{$image}</span>"; $content .= $key == 'prev' ? $tc1.$tc2 : $tc2.$tc1; $content .= " </span>"; $content .= " </span>"; $content .= "</a>"; } return $content; } else { return $content; } }
January 13, 2018 at 6:31 am #896851December 20, 2020 at 5:55 am #1268718Hi, will this “next” and “previous” portfolio link work on the theme Enfold?
December 20, 2020 at 9:18 pm #1268862Hi natas442,
Please open a new ticket for your problem. Provide us admin access to have a deeper look into the issue, as well as precise links where we can see the issue. Screenshots highlighting what’s going on would help a lot (imgur.com, dropbox).
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.