Is it possible in the Portfolio setup to make the read more button open a pdf file on my server or wp meda file?
Read More Post to PDF
9 posts from 3 voices-
Posted 1 year ago #
-
Hey,
yes - in template_portfolio.php replace:
<a href="<?php echo get_permalink(); ?>" class="more-link">Read more</a>with:
<?php 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{ ?> <a href="<?php echo get_permalink(); ?>" class="more-link">Read more</a> <?php } ?>Afterwards add a custom field to all poprtfolio items with pdf documents. Call the custom field "pdffile" and as value type in the url to the pdf document.
Posted 1 year ago # -
Dude, (Since that's your name) Love it,
Thank you so much for your responses to all my forum questions.
Regarding this one, is there a way to put a target_blank for these links so that they open in a new page or tab?
Posted 1 year ago # -
Yes that's possible. Instead of the code I posted above use:
<?php if (get_post_meta($post->ID, 'pdffile', true) != ''){ echo '<a class="more-link" target="_blank" href="'.get_post_meta($post->ID, 'pdffile', true).'">Download PDF document</a>'; }else{ ?> <a href="<?php echo get_permalink(); ?>" class="more-link">Read more</a> <?php } ?>Posted 1 year ago # -
Hi there,
Is it possible to do this for the 'Avisio' theme?
Thanks.
Posted 1 year ago # -
Hey,
yes - in template_portfolio.php replace:
echo "<a href='".get_permalink()."' class='more-link'>".__('Read more','avisio')."</a>";with:
<?php if (get_post_meta($post->ID, 'pdffile', true) != ''){ echo "<a href='".get_post_meta($post->ID, 'pdffile', true)."' class='more-link'>".__('Download PDF document','avisio')."</a>"; }else{ ?> echo "<a href='".get_permalink()."' class='more-link'>".__('Read more','avisio')."</a>"; <?php } ?>Afterwards add a custom field to all poprtfolio items with pdf documents. Call the custom field "pdffile" and as value type in the url to the pdf document.
Posted 1 year ago # -
Hi there,
Doing that breaks the page (just blank white)?
Posted 1 year ago # -
I've just found the post in the 'Avisio' section. All sorted now. Many thanks.
Posted 1 year ago # -
Glad that you solved the problem :)
Posted 1 year ago #
Reply
You must log in to post.














