• Resolved Blackiesboy

    (@blackiesboy)


    I have created a slide using masterslider plugin. I can load it on to “ordinary pages in the body of the page however I cannot get it to load into the slider template area. I want to load this as a slider on my front page rather than use the customizr slider. I tried loading the php code for the slide into the functions.php in my child theme but it hasn’t worked. Can it be done and if so where do I load the php code.

    the php code is <?php masterslider(12); ?>

    when I load into body of an ordinary page it looks like this http://pbadvisory.com.au/averta-test/ I really want it where the customizr slider goes ie above the breadcrumb in the page listed above.

Viewing 7 replies - 1 through 7 (of 7 total)
  • In your child-theme functions.php:

    add_action('wp', 'replace_customizr_slider',100);
    function replace_customizr_slider(){
        if ( ! tc__f('__is_home') )
            return;
        // just in home
        remove_action('template_redirect', array(TC_slider::$instance, 'tc_set_slider_hooks') );
        remove_action('template_redirect', array(TC_slider::$instance, 'tc_set_slider_options') );
    
        // put our slider after header
        add_action('__after_header', 'our_slider', 10);
        function our_slider(){
            masterslider(12);
        }
    }

    This should work.

    Thread Starter Blackiesboy

    (@blackiesboy)

    Thanks d4z-c0nf, This has worked on the front page.
    If I wanted to change another page would i use the same script but change
    if ( ! tc__f(‘__is_home’) )
    return;
    to
    if ( ! tc__f(‘__is_pagename‘) )
    return;

    and of course the slider id.

    Thread Starter Blackiesboy

    (@blackiesboy)

    Thanks d4z_c0nf, This has worked on the front page.
    If I wanted to change another page would i use the same script but change
    if ( ! tc__f(‘__is_home’) )
    return;
    to
    if ( ! tc__f(‘__is_pagename’) )
    return;

    and of course the slider id.

    nope.
    tc__f('__is_pagename') will not work.
    You have to look at the conditional tags for that but.. Now that I think about it, just don’t set customizr sliders at all and use something like:

    add_action('__after_header', 'my_sliders');
    function my_sliders(){
        $id = get_queried_object_id();
        $sliders = array(
           // page/post_id => masterslider_id
            '0' => '12', // 0 is the $id if you show the blog on your home page
            '33' => '20'
        );
        if ( array_key_exists($id, $sliders) )
            masterslider($sliders[$id]);
    }

    Thread Starter Blackiesboy

    (@blackiesboy)

    Hi d4z_c0nf,

    Unfortunately this code snippet doesn’t work unless I have done something wrong which could be the case.

    1. I Changed Customizr to no slider
    2. Copied the above into the function.php replacing the code you gave me earlier.
    3. changed the final line masterslider($sliders[$id]); to masterslider(12);

    Cheers

    Of course it doesn’t work.
    You asked for

    If I wanted to change another page would i use the same script but change

    so I said ok, the 3d step you had to do was replacing,
    ‘0’ and ’33’ with two page id in which you want the masterslider.
    Then ’12’ and ’20’ with the respective masterslider ids you wanted to display in those pages.
    Cheers

    Thread Starter Blackiesboy

    (@blackiesboy)

    Thanks d4z_c0nf.

    It works a treat! I’ll give myself an uppercut!

    Cheers

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Loading Slides from Masterslider plugin into Customizr theme’ is closed to new replies.