Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #4577

    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?

    #46835

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

    #46836

    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?

    #46837

    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')
    );

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘PDF Portfolio Read More’ is closed to new replies.