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.
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.
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]);
}
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
Thanks d4z_c0nf.
It works a treat! I’ll give myself an uppercut!
Cheers