The shortcodes in my plugin work as any others would. If you’re using another template you can try to use the do_shortcode
function instead:
<?php do_shortcode ([gview...]); ?>
If you find that doesn’t work for some reason, do let me know. If this is not what you intend, please explain what you’re wanting to do better, and ideally show a plugin that does what you’re expecting with a shortcode. Thanks.
Hi k3davis,
Thanks for the quick reply. But I am still not getting it correct. Here are the steps I followed:
1. I created a template page “GoogleDoc.php” in which [gview…] definition is hardcoded in body tag.
eg. <body>[gview file=”http://www.yoururl.com/doc.pdf”%5D</body>
Other codes : <?php get_header(); ?> <?php get_footer(); ?> etc. are also intact as in default template(index.php)
2. Now, I created a blank page using “Add New Page” in WP and assigned it above template (GoogleDoc). When previewing it failed to display the document.
Result:
I am getting below text instead of the document:
[gview file=”http://www.yoururl.com/doc.pdf”%5D
I also tried using below code, but it also failed:
<?php do_shortcode([gview file=”http://www.yoururl.com/doc.pdf”%5D); ?>
I am not much of tech guy and have no idea how do_shortcode function will behave. Please let me know if I am missing any other detail.
Hi Deepak,
I think I added confusion in my answer rather than clear it up. Please try the following code instead:
<?php echo do_shortcode('[gview file="http://www.yoururl.com/doc.pdf"]'); ?>
Note the “echo” which I neglected in my first response.
If this does not work, please give me the following info – you may do so ere or privately within the support link on your plugin list:
* The URL of the file you’re trying to embed
* Any error message you receive (if not just the shortcode printing out) – also check the HTML comments of the page at the location the viewer is being called if nothing appears for messages – view the source of the page and search for “gde” for quick access.
Hope this helps.
Kevin
A big thank you Kevin.
The above code with echo is working fine now.
Deepak