wordpress – how to get jquery slide caption and title

I am beginner in PHP, so maybe for some of you this question is ridiculous.

I would like to get image title and caption from jquery slider. (Themeforest Delight theme – http://www.pixedelic.com/themes/delight/), to show them in the same way as in (http://themes.themegoods.com/dk_wp/).

Read More

I have tried almost everything.

Thanks in advance for your help.

Here is the code from header:

<?php
function default_bg(){
    if(get_pix_option('pix_general_background')=='slideshow'){ ?>
        <div class="pix_slide" data-position="fixed" data-top="0" data-bottom="not">
            <?php 
            $slide_general = get_pix_option('pix_array_slide_general_');
            foreach ($slide_general as $slide) {
                echo '<div data-src="'. $slide .'" data-thumb="'. get_pix_thumb($slide, 'exTh') .'" data-content="'. get_pix_content($slide) .'"></div>';
            }

            ?>

I have found some script, which get the content, but can’t implement it.

Here it is:

content: jQuery('#pix_credits_pictures').html(),
            events: {
                show: function(event, api) {
                    api.set('content.text', jQuery('#pix_credits_pictures').html());
                }
            },

Related posts

Leave a Reply

1 comment

  1. You will need to modify the way the jQuery slider to include custom attributes for the images to include the title and the caption. Something like:

    <?php
        $slide_captions = array("caption1","caption2"...);
        $slide_title = array("title1","title2"...);
    ?>
    
    
    <?php
        function default_bg(){
        if(get_pix_option('pix_general_background')=='slideshow'){ ?>
            <div class="pix_slide" data-position="fixed" data-top="0" data-bottom="not">
            <?php 
                $slide_general = get_pix_option('pix_array_slide_general_');
                $c = 0;
                foreach ($slide_general as $slide) {
                    echo '<div data-src="'. $slide .'" data-thumb="'. get_pix_thumb($slide,     'exTh') .'" data-content="'. get_pix_content($slide) .'" image_title="'.$slide_title [$c].'" image_caption="'.$slide_captions[$c].'" class="slide_item"></div>';         
                    $c++;
                }
    ?>
    

    You can implement a more elegant solution for “storing” the titles and captions instead of an array, I guess that depends on the way your plugin works and how it is storing the images.

    Next up you can access the title and captions using jQuery like so:

    var image_title= $('.slide_item').attr('slide_title');
    var image_caption= $('.slide_item').attr('image_caption');
    

    Obviously you will have to decide where exactly you want to use the title and when, but that is how you access them. The best way is probably to modify the slider library on the active image event.