• I want to embed PDF on a Product’s Quick View using PDF Embedder and Advanced Custom Fields plugins.

    Here is the code I put on quick-view-content.php:

    <?php $pdf = get_field( 'datasheetquickview' ); ?>
    <?php if ( $pdf ) { ?>
    
    <?php echo do_shortcode('[pdf-embedder url="'.get_field('datasheetquickview').'"]'); ?>
    <?php } ?>

    Unfortunately, PDF is not returned as an embedded file, it only returns a link to the file (see image).

    What might be the issue here?

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hello,

    Does the shortcode work on a page or post? Have you contacted the plugin support for this issue?

    Thread Starter stoicassistant

    (@nickschmitt)

    I contacted them, no response yet. Shortcode works on regular pages, however perhaps it conflicts with Quick View settings.

    I checked the attached link but it is not working. Can you share a working site link where you have embedded PDF?

    Thread Starter stoicassistant

    (@nickschmitt)

    I updated the page, see here. Using the following code I have embedded product PDF on archive page.

    <?php add_action('ocean_after_archive_product_title', 'product_datasheet_embed_display_below_title', 5);
    	
    function product_datasheet_embed_display_below_title() {
    if( get_field ('datasheetquickview')): ?>
    <?php echo do_shortcode('[pdf-embedder url="'.get_field('datasheetquickview').'"]'); ?>
    <?php endif;}

    Is it possible to display this in Quick View?

    Thread Starter stoicassistant

    (@nickschmitt)

    Yes, there is a conflict with Quick View, because that Embed only displays properly when Quick View is turned off. When Quick View is turned on in Appearance>Customize, it displays as a plain link.

    Can you please tell me the steps to replicate this issue so that I can check it on my end?

    Thread Starter stoicassistant

    (@nickschmitt)

    Yesterday I was able to display PDF embed on Archive page, but now I am unable to replicate this and only plaintext is displayed.

    Last time, using Snippets plugin, I added the following code:

    add_action('ocean_after_archive_product_title', 'product_datasheet_embed_display_below_title', 5);
    	
    function product_datasheet_embed_display_below_title() {
    if( get_field ('datasheetquickview')): ?>
    <?php echo do_shortcode('[pdf-embedder url="'.get_field('datasheetquickview').'"]'); ?>
    <?php endif;}

    With Quick View turned off, Archive page successfully displayed embed for each product.

    When I turned Quick View on, embeds were broken and only plaintext was displayed.

    When I turned Quick View off again, embed is still broken and only plaintext is displayed.

    So I have been unable to replicate the embed on Archive page.

    Are you using ACF with PDF Embedder plugin? If yes, then follow the ACF documentation to return the file URL correctly – https://www.advancedcustomfields.com/resources/file/
    It seems, your code is not returning the URL correctly for the quick view.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘PDF Embedder not working on quick-view-content.php’ is closed to new replies.