WordPress.org

Ready to get started?Download WordPress

Forums

Slideshow
[resolved] How to add get caption data as well as description? (3 posts)

  1. nicolaelvin
    Member
    Posted 1 year ago #

    My site is loading different translations (i.e. text) depending on a cookie that is set when the user chooses a language.

    I need to be able to use the same gallery but just change the description text when the cookie is set. In what file in the plugin can I make the $slide array contain the caption text (which is a field in the image in media library). Also, what file I can add my conditional statement in:

    if($language == 'polish'){
         echo $slide['caption'];
    else{
         echo $slide['description'];
    }

    Hope that makes sense.

    http://wordpress.org/extend/plugins/slideshow-jquery-image-gallery/

  2. Stefan Boonstra
    Member
    Plugin Author

    Posted 1 year ago #

    In version 2.1.23 of the Slideshow plugin the file can be found in 'yoursite.com/wp-content/plugins/slideshow-jquery-image-gallery/views/SlideshowPlugin/slideshow.php'. Look for lines 80 through 83. These lines set the title and description for the image slides. I think you may want to make the code look something like this:

    if(empty($title))
    	$title = SlideshowPluginSecurity::htmlspecialchars_allow_exceptions($attachment->post_title);
    if($language == 'polish')
    	$description = SlideshowPluginSecurity::htmlspecialchars_allow_exceptions($attachment->post_excerpt);
    elseif(empty($description))
    	$description = SlideshowPluginSecurity::htmlspecialchars_allow_exceptions($attachment->post_content);

    The disadvantage of this approach is that you cannot update the Slideshow plugin, as it would overwrite the changes you've made to its files.

    I would personally prefer creating a slideshow for every language, performing the '$language' check in my post, page or theme. There are a couple of language plugins that can help with that.

  3. nicolaelvin
    Member
    Posted 1 year ago #

    Thats great thank you so much. I was looking everywhere last night for the right file. Brilliant plugin, thank you.

    I know it would be better not to edit the plugin, but it will confuse my client if she has multiple galleries for what she sees are the same page.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.