WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [Plugin: Google Doc Embedder] embed it in the codex (8 posts)

  1. mm88
    Member
    Posted 3 years ago #

    Hi, the syntax to put the GVIEW plugin into a page is: [gview file="http://url.to/file.pdf"]

    but what is the (PHP/WP) syntax to put it in a .php page (attachment.php for ex.) in editing mode?

    a good alternative to GVIEW and editing flexible exists?

    thanks

  2. k3davis
    Member
    Posted 3 years ago #

    Try the following:

    <?php echo do_shortcode('[gview file="http://url.to/file.pdf"]'); ?>

    Let me know if this does or doesn't work, as I've not done this in a while.

  3. mm88
    Member
    Posted 3 years ago #

    thanks k3davis, it works!!! But now I have a problem passing the path variable.

    Writing

    <?php $filepdf = wp_get_attachment_url($post->ID);
    
    echo do_shortcode('[gview file="."$filepdf"."]'); ?>

    it dosen't work.

    thanks again

  4. k3davis
    Member
    Posted 3 years ago #

    I'm not sure just what you're doing there, so I'm not sure how much help I can be. What does not work when you do it this way, for starters? Does the viewer load but the document doesn't display? Does nothing display at all (check the page source for "GDE" to see if any error is found there)?

  5. mm88
    Member
    Posted 3 years ago #

    It Does nothing display at all, because there's an error in my php code syntax. The problem is displaying the $filepdf variable in the function echo.

    I don't know the correct syntax.

    thanks

  6. k3davis
    Member
    Posted 3 years ago #

    I'm still not sure exactly what you're trying to do, but you can try this:

    <?php $filepdf = wp_get_attachment_url($post->ID);
    
    echo do_shortcode('[gview file="'.$filepdf.'"]'); ?>

    It may just be a quotes problem, but then again I've never tried to pass a variable using the do_shortcode function, so I'm not sure if this is supported or not.

  7. mm88
    Member
    Posted 3 years ago #

    yes, it was a quotes problem: Now it works!

    many thanks k3davis!

  8. k3davis
    Member
    Posted 3 years ago #

    Glad it worked out. :)

Topic Closed

This topic has been closed to new replies.

About this Topic