-
ayap789
Hi Support,
I’m attempting to create a page where links to download PDF documents would be displayed.
I want this to be more seamless than having to upload the file, create a shortcode using a Download Manager-type plug-in then manually creating having to add the button or link using the shortcode.I wanted to implement the Query Loop capability of WordPress and GP/GB to call all the posts using their corresponding category/tags. This way, the Query Loop would automatically display any posts created with specific tags. At this point, everything seems to work great by using Adding Parameter>Taxonomies>Category/Tags.
This brings me to my first question, how would I create a Query Loop view which only displays the Post Title within button-like containers shown here: https://i.postimg.cc/SsbDp5hw/Screenshot-2023-07-20-at-7-08-28-PM.png (link #1) (Created manually for illustration purposes).
Now, I want the links to the posts to act like links to the actual document/file. This means that when the user clicks on the link to the post, they should go straight to the browser display of the document/PDF.
In the native WordPress view of post creation, there’s an option to attach a file to the post. I’m not sure that this would work but I can’t test because whenever I add/edit a post it goes straight to the GP theme editor.
This is the second question, is there a way to attach the file/PDF to the post so that when users click on the link to the post, they are directed straight to the file/PDF? If not, what’s a good work around?
Thanks all.
-
Fernando
Hi Ayap,
#1 In your Query Loop Block, just add a GB Headline Block inside the Post Template Block, and use this to retrieve the Title. This should be the only content. References:
https://docs.generateblocks.com/article/headline-overview/
https://docs.generateblocks.com/article/dynamic-data-options-overview/#title#2 The ideal way would be to create a custom meta field for your Posts to store the PDF link. We can then retrieve this meta as the value for Dynamic Headline Block’s Link Source. Reference: https://docs.generateblocks.com/article/dynamic-data-options-overview/#link-post-meta
A popular plugin to create custom meta fields is ACF. Reference: https://www.advancedcustomfields.com/resources/getting-started-with-acf/
This is the optimal way to do such a thing with a GB Query Loop Block.
-
ayap789
Hi Fernando,
Thanks for this. I’ll try to implement everything and let you know how it goes.
-
Fernando
You’re welcome, Ayap!
-
ayap789
Hi Fernando/Support,
Was successfully able to implement step 1 where the Query Loop pulls the Title of the post into a Container that looks like a button.
And I believe I’ve done step 2 correctly where I configured “Link Source” to “Post meta” and inserted the custom field I created using ACF as seen here: https://postimg.cc/WDFgqSwC .
Now I’m trying to find where to insert the link to the PDF on the post side. I’m assuming I have to trying locate the Custom Field I created let’s call it “Link”. Where would this be located so I can upload the file URL to?
Thanks again!
Everything seems to be going great so far. -
David
Hi there,
when you created your ACF Custom Field, it has a Location:
https://www.advancedcustomfields.com/resources/creating-a-field-group/#location
make sure that is set to the posts where you require it.
Then edit a post and the ACF meta box for the field should be at the bottom of the post editor.
-
ayap789
Hi Fernando & David,
Everything is working great!
Awesome that the Generate + ACF system can accommodate for this. Thanks for exposing me to this method.
I will keep this topic open while I continue to test thanks again for now.
-
You’re welcome
-
ayap789
Hi all,
This worked great.
Thanks again!
- You must be logged in to reply to this topic.