Topic: Function Option


Is there a way to use a FUNCTION in my Theme file that calls SimpleViewer for each post?

Thanks very much!

Re: Function Option

Do you want to display the same SimpleViewer gallery in every post?
I do not know how you would achieve this without manually copying and pasting the shortcode or embedding code into each post.
If you wish to modify a theme, each theme is different and the best place to ask for advice would be in the theme's own forum (if it has one).

Steven Speirs
SimpleViewer Support Team

Re: Function Option


I'm trying to use in my single.php:

<?php echo do_shortcode('[simpleviewer gallery_id="1"]'); ?>

But it is not working.

What I would like to do is use a function to call the simpleviewer in my single.php and my client just need to upload the images in each post, without including the shortcode inside the editor all the time.

Do you think is that possible?

Re: Function Option

Entering the same shortcode into each post will result in the same gallery XML file (and therefore the same images) being used in each gallery.
WP-SimpleViewer generates static XML files (a predetermined list of images) and you would need a dynamic XML file that is generated on-the-fly to display images in a certain folder.
This can be achieved by using a PHP file instead of an XML file as described in this thread: … p?id=12892
However, you would need to modify WP-SimpleViewer to look for and use the PHP file instead of an XML file.
Also, you would need to include some variable in order to tell the PHP file to look in a different folder for each post's gallery.
No doubt it is possible, but it would require a lot of work.
If your client is uploading or attaching images to each post anyway, it would be much easier to just create a gallery with WP-SimpleViewer and allow the plugin to insert the required shortcode automatically.

Steven Speirs
SimpleViewer Support Team