• Resolved robbas

    (@robbas)


    Well normally i would add this in the javascript call for NivoSlider. But i have to say, i like metaSlider ALOT and i would like to customize some caption effects.

    I allready had some results with AfterLOad and BeforeChange but i dont know where i could declare these functions… so the current php call

    protected function get_param($param) {
    $params = array(
    ‘effect’ => ‘effect’,
    ‘slices’ => ‘slices’,

    But how do i declare the AfterLoad and BeforeChange function in here ?

    or maybe i should ask myself, is it even possible to declare these in the first place, thanks in advance

    http://ww.wp.xz.cn/plugins/ml-slider/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi Robbas,

    Yes, its possible using a filter. You’ll want to add something like this to your themes functions.php file:

    function metaslider_nivo_params($options, $slider_id) {
        if ($slider_id == 123) { // check for slider ID (optional)
            $options['afterLoad'][] = "alert('after load');";
            $options['beforeChange'][] = "alert('before change');";
        }
        return $options;
    }
    add_filter('metaslider_nivo_slider_parameters', 'metaslider_nivo_params', 10, 2);

    If you view the source of the page after adding that code you should be able to see what meta slider is doing (one thing to note is it will automatically wrap your javascript in a function – so you don’t want to specify that yourself).

    There’s some more info here: http://www.metaslider.com/documentation/developers/

    Regards,
    Tom

    Thread Starter robbas

    (@robbas)

    Hi Matcha Labs,

    Thank you for your reply, i will definitely check out that link, completely overlooked the documentation “great that you guys have one!”

    i will try the code for functions.php out and check my page source. Is it correct that you placed the 2 jscript functions “alert ( load / before change” within you php function. I dont have much expierence combining these 2 languages together, but i can see what you are doing here”i think”

    I should be able to go further now, thank you again!

    Regards
    Robbas

    Hi Robbas,

    Yes, they’re in the PHP function.

    When Meta Slider generates the HTML output for the slider it’ll put those alerts into the JavaScript. It’s a bit confusing to begin with but just check the page source after you’ve added the code and it should become clear 🙂

    Regards,
    Tom.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘AfterLoad and beforeChange’ is closed to new replies.