Support » Theme: OceanWP » PDF Embedder not working on quick-view-content.php

  • stoicassistant

    (@nickschmitt)


    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)
  • Amit Singh

    (@apprimit)

    Hello,

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

    stoicassistant

    (@nickschmitt)

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

    Amit Singh

    (@apprimit)

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

    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?

    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.

    Amit Singh

    (@apprimit)

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

    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)
  • You must be logged in to reply to this topic.