Viewing 23 posts - 1 through 23 (of 23 total)
  • Author
    Posts
  • #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 8 years, 7 months ago by lucasvrooij.
    #502322

    Hey 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,
    Elliott

    #506362

    Hello 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 Rooij

    #506577

    Hey!

    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!
    Elliott

    #506605

    Hi 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

    #507141

    Hey!

    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,
    Elliott

    #510004

    Hi 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!

    #510298

    Hey!

    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!
    Elliott

    #512004

    Hi 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.

    #512387

    Hey!

    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 8 years, 6 months ago by Elliott.
    #512693

    Hi 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.

    #512994

    Hi!

    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,
    Elliott

    #512998

    Elliott,

    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.

    #513013

    Hi!

    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,
    Elliott

    #513037

    Elliott,

    I uploaded a short video to show you the problem.

    Kind regards.

    #513582

    Hey!

    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,
    Andy

    #704247

    Hi 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.php

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

    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,
    Philipp

    #704453

    Never 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;
        }
      }
    #705954

    Hi,

    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,
    Nikko

    #896589

    It 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;
        }
      }
    #896851

    Hi martanu,

    Great, glad you got it working :-)

    Best regards,
    Rikard

    #1268718

    Hi, will this “next” and “previous” portfolio link work on the theme Enfold?

    #1268862

    Hi 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

Viewing 23 posts - 1 through 23 (of 23 total)
  • You must be logged in to reply to this topic.