- This topic is empty.
-
AuthorPosts
-
January 20, 2012 at 1:19 pm #36231morgonParticipant
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/55b934a1264580814ac1To 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!
January 21, 2012 at 9:18 am #95129MottieMemberHi 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).'
'; ?>
" rel="bookmark" >
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.
-
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.