Support Forum
Hi,
I'm trying to figure out how to show the PDFs that I've added to a post category I created for a journal. I've managed to get the title, image, and link to the single page set up. I can't figure out how to add the file__advanced URL to the page so they can click "Download" and download the PDF for that category.
https://test.cbmw.refsites.com/journal/
I'm trying to get the PDF to download when I click on the "Download" button.
Below is what I have. I've tried adding the code from the "Insert Field" area but it didn't do anything.Where it says "Download" is where the link is that I'm trying to fiture out. I've tried several things but nothing seems to pull in the File URL.
{% set args = {taxonomy: 'issue',hide_empty: false, nopaging: false, order: 'DESC',} %}
{% set issues = mb.get_categories( args ) %}
<div class="thumbnail-images">
{% for issue in issues %}
<div class="item">
<div class="overlay-thumbnail-categories"></div>
<div class="wp-block-stackable-columns stk-block-columns stk-block stk-8db0573" data-block-id="8db0573"><style>.stk-8db0573 {border-top-left-radius:6px !important;border-top-right-radius:6px !important;border-bottom-right-radius:6px !important;border-bottom-left-radius:6px !important;overflow:hidden !important;border-style:solid !important;border-color:#0000002e !important;padding-top:20px !important;padding-right:20px !important;padding-bottom:20px !important;padding-left:20px !important;}.stk-8db0573-column{--stk-column-gap:20px !important;}@media screen and (max-width: 767px){.stk-8db0573 {padding-top:20px !important;padding-right:20px !important;padding-bottom:20px !important;padding-left:20px !important;margin-bottom:50px !important;--stk-col-order-1:2 !important;--stk-col-order-2:1 !important;}}</style><div class="stk-row stk-inner-blocks stk-block-content stk-content-align stk-8db0573-column"><!-- wp:stackable/column {"uniqueId":"371e64a","innerBlockAlign":"center"} -->
<div class="wp-block-stackable-column stk-block-column stk-column stk-block stk-371e64a" data-v="4" data-block-id="371e64a"><style>.stk-371e64a-inner-blocks{justify-content:center !important;}</style><div class="stk-column-wrapper stk-block-column__content stk-container stk-371e64a-container stk--no-background stk--no-padding"><div class="stk--column-flex stk-block-content stk-inner-blocks stk-371e64a-inner-blocks"><!-- wp:stackable/heading {"uniqueId":"7a00160"} -->
<div class="wp-block-stackable-heading stk-block-heading stk-block-heading--v2 stk-block stk-7a00160" id="eikon-6-1-spring-2024" data-block-id="7a00160"><h2 class="stk-block-heading__text"><a href="{{ mb.get_category_link( issue.term_id ) }}">{{ issue.name }}</a></h2></div>
<!-- /wp:stackable/heading -->
<!-- wp:stackable/text {"uniqueId":"fffcfd8","blockMarginMobile":{"bottom":30}} -->
<div class="wp-block-stackable-text stk-block-text stk-block stk-fffcfd8" data-block-id="fffcfd8"><style>@media screen and (max-width: 767px){.stk-fffcfd8 {margin-bottom:20px !important;}}</style><p class="stk-block-text__text" style="margin-bottom:20px"><strong>In this Issue:</strong> A Biblical Vision Of The Sexes: Harmonious Asymmetry - Doug Ponder, Feminism’s Patriarchs:</p></div>
<!-- /wp:stackable/text -->
<!-- wp:stackable/button-group {"uniqueId":"c12f040","buttonFullWidth":true} -->
<div class="wp-block-stackable-button-group stk-block-button-group stk-block stk-c12f040" data-block-id="c12f040"><style>.stk-c12f040 .stk-button-group{flex-direction:row !important;}.stk-c12f040 .stk-block-button, .stk-c12f040 .stk-block-icon-button{flex:1 0 0% !important;}@media screen and (max-width: 1023px){.stk-c12f040 .stk-button-group{flex-direction:row !important;}}@media screen and (max-width: 767px){.stk-c12f040 .stk-button-group{flex-direction:row !important;}}</style><div class="stk-row stk-inner-blocks stk-block-content stk-button-group"><!-- wp:stackable/button {"uniqueId":"c2478dd"} -->
<div class="wp-block-stackable-button stk-block-button stk-block stk-c2478dd" data-block-id="c2478dd">
<a href="{{ mb.get_category_link( issue.term_id ) }}"><span class="stk-button__inner-text">View Articles</span></a></div>
<!-- /wp:stackable/button -->
<!-- wp:stackable/button {"uniqueId":"c747eba","icon":"\u003csvg xmlns=\u0022http://www.w3.org/2000/svg\u0022 viewBox=\u00220 0 512 512\u0022\u003e\u003cpath d=\u0022M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z\u0022/\u003e\u003c/svg\u003e"} -->
<div class="wp-block-stackable-button stk-block-button stk-block stk-c747eba" data-block-id="c747eba">
<a href="{{ item.url }}">
<span class="stk--svg-wrapper">
<div class="stk--inner-svg">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" aria-hidden="true" width="32" height="32">
<path d="M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"></path></svg>
</div></span><span class="stk-button__inner-text"><strong>Download</strong></span></a></div>
<!-- /wp:stackable/button --></div></div>
<!-- /wp:stackable/button-group --></div></div></div>
<!-- /wp:stackable/column -->
{% set image_upload = mb.get_term_meta( issue.term_id, 'thumbnail_images_category', true ) %}
{% set image_url = mb.get_term_meta( issue.term_id, 'url_images_category', true ) %}
{% if image_upload %}
{% set image_upload_link = mb.wp_get_attachment_image_src( image_upload, 'medium' ) %}
<!-- wp:stackable/column {"uniqueId":"2ba7f5c"} -->
<div class="wp-block-stackable-column stk-block-column stk-column stk-block stk-2ba7f5c" data-v="4" data-block-id="2ba7f5c"><div class="stk-column-wrapper stk-block-column__content stk-container stk-2ba7f5c-container stk--no-background stk--no-padding"><div class="stk-block-content stk-inner-blocks stk-2ba7f5c-inner-blocks"><!-- wp:stackable/image {"uniqueId":"e74ef15","blockShadow":"0 5px 30px -10px rgba(18, 63, 82, 0.3)","imageUrl":"https://test.cbmw.refsites.com/wp-content/uploads/2024/10/journal-Issue_6.1.jpg","imageId":38278,"imageWidthAttribute":1000,"imageHeightAttribute":1600,"blockMarginMobile":{"top":"","right":"","bottom":20,"left":""}} -->
<div class="wp-block-stackable-image stk-block-image stk-block stk-e74ef15" data-block-id="e74ef15">
<style>.stk-e74ef15 {box-shadow:0 5px 30px -10px rgba(18, 63, 82, 0.3) !important;}@media screen and (max-width: 767px){.stk-e74ef15 {margin-bottom:20px !important;}}</style><figure><span class="stk-img-wrapper stk-image--shape-stretch">
<img src="{{ image_upload_link[0] }}" width="1000" height="1600" /></span></figure></div>
<!-- /wp:stackable/image --></div></div></div>
{% elseif image_url %}
<!-- wp:stackable/column {"uniqueId":"2ba7f5c"} -->
<div class="wp-block-stackable-column stk-block-column stk-column stk-block stk-2ba7f5c" data-v="4" data-block-id="2ba7f5c"><div class="stk-column-wrapper stk-block-column__content stk-container stk-2ba7f5c-container stk--no-background stk--no-padding"><div class="stk-block-content stk-inner-blocks stk-2ba7f5c-inner-blocks"><!-- wp:stackable/image {"uniqueId":"e74ef15","blockShadow":"0 5px 30px -10px rgba(18, 63, 82, 0.3)","imageUrl":"https://test.cbmw.refsites.com/wp-content/uploads/2024/10/journal-Issue_6.1.jpg","imageId":38278,"imageWidthAttribute":1000,"imageHeightAttribute":1600,"blockMarginMobile":{"top":"","right":"","bottom":20,"left":""}} -->
<div class="wp-block-stackable-image stk-block-image stk-block stk-e74ef15" data-block-id="e74ef15"><style>.stk-e74ef15 {box-shadow:0 5px 30px -10px rgba(18, 63, 82, 0.3) !important;}@media screen and (max-width: 767px){.stk-e74ef15 {margin-bottom:20px !important;}}</style><figure><span class="stk-img-wrapper stk-image--shape-stretch"><img src="{{ image_url }}" width="1000" height="1600" /></span></figure></div>
<!-- /wp:stackable/image --></div></div></div>
{% else %}
<!-- wp:stackable/column {"uniqueId":"2ba7f5c"} -->
<div class="wp-block-stackable-column stk-block-column stk-column stk-block stk-2ba7f5c" data-v="4" data-block-id="2ba7f5c"><div class="stk-column-wrapper stk-block-column__content stk-container stk-2ba7f5c-container stk--no-background stk--no-padding"><div class="stk-block-content stk-inner-blocks stk-2ba7f5c-inner-blocks"><!-- wp:stackable/image {"uniqueId":"e74ef15","blockShadow":"0 5px 30px -10px rgba(18, 63, 82, 0.3)","imageUrl":"https://test.cbmw.refsites.com/wp-content/uploads/2024/10/journal-Issue_6.1.jpg","imageId":38278,"imageWidthAttribute":1000,"imageHeightAttribute":1600,"blockMarginMobile":{"top":"","right":"","bottom":20,"left":""}} -->
<div class="wp-block-stackable-image stk-block-image stk-block stk-e74ef15" data-block-id="e74ef15"><style>.stk-e74ef15 {box-shadow:0 5px 30px -10px rgba(18, 63, 82, 0.3) !important;}@media screen and (max-width: 767px){.stk-e74ef15 {margin-bottom:20px !important;}}</style><figure><span class="stk-img-wrapper stk-image--shape-stretch"><img src="https://test.cbmw.refsites.com/wp-content/uploads/2024/10/journal-Issue_6.1.jpg" width="1000" height="1600" /></span></figure></div>
<!-- /wp:stackable/image --></div></div></div>
{% endif %}
<!-- /wp:stackable/column --></div></div>
</div>
{% endfor %}
</div>
Hello Eric,
I see the Download button has the link to download the PDF file, do you complete the task yourself? If you want to output the file advanced field, please refer to the documentation https://docs.metabox.io/fields/file-advanced/#template-usage
Hi Peter,
Thanks for looking. I did figure out how to add it. I used a file input field instead of a file__advanced field. That seemed to make a difference
What I can't figure out now is how to add the pdf download to the Category page. I have it set up on the archive page, but I also have a category page that I'm using for the individual Issue. This shows the category that certain articles are added to. I was able to put the cover image in and the header image for the category, but it doesn't see to want to read the PDF that I'd like someone to download.
Here is an example. I tried using the "Insert Field" feature that creates this tag {{ term.pdf_download }}
But it doesn't display the PDF url, just an array.
The Download button is where the PDF should be showing for each issue.
https://test.cbmw.refsites.com/issue/eikon-6-1-spring-2024/
Any thoughts?
I got it to work when I created a new field using the "url" field type. I just don't understand why it won't work using the file_input field. I guess I can use both, but I thought it would be easier to have only one field option.