I need the read more button for the portfolio to open up a pdf file in my root directory. Same like I needed for display theme. Do I use the same code and put a custom field on the pages again?
PDF Portfolio Read More
4 posts from 2 voices-
Posted 1 year ago #
-
Hey,
yes - replace following code in template_portfolio.php:echo "<a href='".get_permalink()."' class='more-link'>".__('Read more','avisio')."</a>";with:
if (get_post_meta($post->ID, 'pdffile', true) != ''){ echo '<a class="more-link" href="'.get_post_meta($post->ID, 'pdffile', true).'">Download PDF document</a>'; }else{ echo "<a href='".get_permalink()."' class='more-link'>".__('Read more','avisio')."</a>"; }Posted 1 year ago # -
Thank you,
In the Avisio theme the portfolio is different and is not connected to pages where you can add the custom field. The portfolio for Avisio has an independent portfolio items and on the add new portfolio item there is no way to add a custom field in order to call out the pdf file.
How would I attach a pdf file to that certain portfolio item for Avisio after changing that code?
Posted 1 year ago # -
You need to modify the portfolio options to support custom fields. To do this, open /theme_options/portfolio.php and find this code (around line 59):
$args = array( 'labels' => $labels, 'public' => true, 'show_ui' => true, 'capability_type' => 'post', 'hierarchical' => false, 'rewrite' => array('slug'=>$slugRule,'with_front'=>true), 'query_var' => true, 'show_in_nav_menus'=> false, 'menu_position' => 5, 'supports' => array('title','thumbnail','excerpt','editor','comments') );Change the supports to include custom fields like this:
$args = array( 'labels' => $labels, 'public' => true, 'show_ui' => true, 'capability_type' => 'post', 'hierarchical' => false, 'rewrite' => array('slug'=>$slugRule,'with_front'=>true), 'query_var' => true, 'show_in_nav_menus'=> false, 'menu_position' => 5, 'supports' => array('title','thumbnail','excerpt','editor','comments','custom-fields') );Posted 1 year ago #
Reply
You must log in to post.














