WordPress.org

Ready to get started?Download WordPress

Forums

Embed PDF
[resolved] Embed PDF using do_shortcode() (4 posts)

  1. adopted3
    Member
    Posted 1 year ago #

    Hello: I have "Embed PDF" version 1.04.

    the [embed]...[/embed] shortcode works fine on a page. But when I use do_shortcode within PHP code on a template page, the plugin doesn't bring up the PDF viewer. Here's how I'm using it:


    <?php
    echo do_shortcode('[embed]'.'http://example.com/example.pdf'.'[/embed]');
    ?>

    Thanks!
    Paul

    http://wordpress.org/extend/plugins/dirtysuds-embed-pdf/

  2. adopted3
    Member
    Posted 1 year ago #

    fyi... i found that this code works:


    <?php
    global $wp_embed;
    $post_embed = $wp_embed->run_shortcode('[embed]http://example.com/example.pdf[/embed]');
    echo $post_embed;
    ?>

    not sure why do_shortcode didn't work.

  3. Pat Hawks
    Member
    Plugin Author

    Posted 1 year ago #

    I agree, it's odd that do_shortcode wasn't working for you.
    Glad you found something that did work, though.

  4. Preeminent
    Member
    Posted 1 year ago #

    Yeah, do_shortcode won't work for me either.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic