mondererdesign
Forum Replies Created
-
Forum: Plugins
In reply to: [Relevanssi - A Better Search] Styling different search result groupsAwesome, thanks!
Forum: Plugins
In reply to: [PDF Image Generator] Not working with Advanced Custom Fields Repeater FieldsHere’s a screenshot of our PDF Image Generator settings, maybe this helps? https://screencast.com/t/fd5bjk4wDP4
Forum: Plugins
In reply to: [PDF Image Generator] Not working with Advanced Custom Fields Repeater FieldsHi @imstanleyyeo,
I hope this helps further…
Here are my settings for the PDF upload in ACF: https://screencast.com/t/jEUo7gpEx0h
I got the code for my functions.php from here: https://pippinsplugins.com/retrieve-attachment-id-from-image-url/
So I have the PDF Image Generator plugin installed as well, and make sure your hosting company support ImageMagick with Ghostscript, or else the PDF image won’t generate at all.
Forum: Plugins
In reply to: [PDF Image Generator] Not working with Advanced Custom Fields Repeater FieldsHi @nroillet,
Here’s how I did it…
Added to functions.php:
// retrieves the attachment ID from the file URL function pippin_get_image_id($image_url) { global $wpdb; $attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s';", $image_url )); return $attachment[0]; }
Added to my template file:
<ul class="resource-feed"> <?php // loop through the rows of data while ( have_rows('resource_upload') ) : the_row(); // display a sub field value $docTitle = get_sub_field('document_title'); $docLink = get_sub_field('document_upload'); // set the image url $image_url = $docLink; // store the image ID in a var $image_id = pippin_get_image_id($image_url); // retrieve the thumbnail size of our image $image_thumb = wp_get_attachment_image_src($image_id, 'medium'); ?><li> <a href="<?php echo $docLink; ?>" target="_blank"> <div class="thumbnail"><img src="<?php echo $image_thumb[0];?>"/></div> </a> <div class="doc-content"> <h2><?php echo $docTitle; ?></h2> <h3><a href="<?php echo $docLink; ?>" target="_blank">Download</a></h3> </div> </li><?php endwhile; ?> </ul>
Forum: Plugins
In reply to: [PDF Image Generator] Not working with Advanced Custom Fields Repeater FieldsI figured it out. I was able to use this code to get the PDF ID from the attachment URL, and then use the ID to display the thumbnail.
https://pippinsplugins.com/retrieve-attachment-id-from-image-url/