Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Modifying a WP theme to use AnythingSlider instead of Nivo Slider

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #36231
    morgon
    Participant

    Howdy folks,

    I’m working on modifying a premium WP theme, and I’d like to switch from using the Nivo slider which is built-in to the AnythingSlider–there are a couple of other sliders on the page for HTML content, which AnythingSlider is more suited for. I’m not a PHP programmer, but I can “tell what’s going on”, and I know my way around WP’s templates ok. I’m in a bit over my head here, though.

    I need to change this snippet of code (already modified from the original to include captions which work with Nivo):
    https://gist.github.com/55b934a1264580814ac1

    To do the following:

    – Load the caption title and slug from the custom fields for each post used in the slider
    – Make them load as external captions (outside the slider) such as with this demo: http://jsfiddle.net/Mottie/pbbYP/343/

    Any help would be greatly appreciated. Thanks!

    #95129
    Mottie
    Member

    Hi Morgon!

    I’m not that great when it comes to php, so I think it should look like this:







    1) $style = "display: none;"; ?>



    ID, "_ttrust_home_slideshow_img_value", true); ?>

    '.get_post_meta($post->ID, "_ttrust_home_slideshow_title_value", true).'

    '.get_post_meta($post->ID, "_ttrust_home_slideshow_caption_value", true).'

    '; ?>


    <?php the_title(); ?>

    " rel="bookmark" ><?php the_title(); ?>












    Then find the javascript that initializes Nivo Slider and replace it with something like this:

    var updateCaption = function(slider){
    var cap = slider.$currentPage.find('p').html();
    $('#current-caption')
    .html(cap)
    .fadeIn(200);
    };

    $('#slider').anythingSlider({

    // add your other options here

    // *********** Callbacks ***********
    // Callback when the plugin finished initializing
    onInitialized: function(e, slider) { updateCaption(slider); },

    // Callback before slide animates
    onSlideBegin: function(e, slider) {
    $('#current-caption').fadeOut(200);
    },

    // Callback when slide completes - no event variable!
    onSlideComplete: function(slider) { updateCaption(slider); }

    });

    Please note that the latest version of AnythingSlider uses css to set it’s width and height, so I removed the variables from the code.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.