Trouble with URL Shortcode when executing from template
-
I am using a custom post type to display documents using Google Doc Embedder.
I’m passing the document URL into a variable called $document and echoing it out. It echoes the URL fine.
When I try to plug the URL into the shortcode function, though, it drops the file name from the URL. I can’t figure it out.
I have an example here: http://ideabasekent.com/staging/slo/production/documents/test-document-2/
Here’s the code I’m using:
<?php while ( have_posts() ) : the_post(); ?> <h2><?php the_title(); ?></h2> <?php the_field('document_description'); ?> <?php if( get_field('document_file_upload') ):?> <?php $document = the_field('document_file_upload');?> <?php echo $document; ?> <?php echo do_shortcode( '[gview file=" '. $document .' " ]' ); ?> <?php endif; ?> <?php endwhile; // end of the loop. ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Trouble with URL Shortcode when executing from template’ is closed to new replies.