Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: Portfolio next/prev buttons in page #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;
        }
      }
Viewing 1 post (of 1 total)