dorofleck
Forum Replies Created
-
Forum: Themes and Templates
In reply to: [Customizr] slider on archive pagehi,
after i foud a solution:add_filter(‘tc_show_slider’ , ‘__return_true’ );
add_filter(‘tc_slider_active_status’ , ‘__return_true’ );
add_filter(‘tc_slider_name_id’ , ‘set_slider_name’);
function set_slider_name( $original_name ) {
if ( ! is_archive() && ! is_search() )
return $original_name;
return ‘my_slider_name’;//<= write the name of your slider here
}
add_filter( ‘tc_customizr_script_params’, ‘tc_allow_slider_autoplay’);
function tc_allow_slider_autoplay( $_params ) {
$_params[‘SliderName’] = ( is_archive() || is_search() ) ? ‘true’ : $_params[‘SliderName’];
return $_params;
}//Part2: to avoid that all category pages have the slider
function tc_get_slider_name_by_cat( $category_slug = null ) {
//Associates category slugs to slider : ‘slug’ => ‘slider name’
$category_list = array (
‘category1’ => ‘slider-one’,
‘category2’ => ‘slider-two’,
‘category3’ => ‘slider-three’,
); //<= if you don’t want to have a slide on the page, just put a non_existing _slidername in. Otherwise replace the slider-names.return ( ! is_null($category_slug) ) ? $category_list[$category_slug] : $category_list;
}function tc_get_cat_slug() {
global $wp_query;
$cat_slug = $wp_query -> query_vars;
return isset($cat_slug[‘category_name’]) ? $cat_slug[‘category_name’] : false;
}add_filter( ‘tc_show_slider’ , ‘tc_show_slider_in_categories’ );
function tc_show_slider_in_categories( $bool ) {
return ( is_category() && array_key_exists( tc_get_cat_slug(), tc_get_slider_name_by_cat() ) ) ? true : $bool ;
}add_filter( ‘tc_slider_name_id’, ‘tc_force_slider_name’);
function tc_force_slider_name( $original_slider_name ) {
return ( is_category() && array_key_exists( tc_get_cat_slug(), tc_get_slider_name_by_cat() ) ) ? tc_get_slider_name_by_cat( tc_get_cat_slug() ) : $original_slider_name ;
}add_filter( ‘tc_slider_active_status’ , ‘tc_force_active_slider’ );
function tc_force_active_slider($bool) {
return ( is_category() && array_key_exists( tc_get_cat_slug(), tc_get_slider_name_by_cat() ) ) ? true : $bool ;
}//display in full width
add_filter( ‘tc_slider_layout’ , ‘tc_force_full_width’ );
function tc_force_full_width( $original_layout_value ){
$layout_value = 0; // 1 for full size slider, 0 for boxed;
return ( is_category() && array_key_exists( tc_get_cat_slug(), tc_get_slider_name_by_cat() ) ) ? $layout_value : $original_layout_value;
}//allow autoplay
add_filter( ‘tc_customizr_script_params’, ‘tc_allow_autoplay’);
function tc_allow_autoplay( $_params ) {
$_params[‘SliderName’] = ( is_category() && array_key_exists( tc_get_cat_slug(), tc_get_slider_name_by_cat() ) ) ? ‘true’ : $_params[‘SliderName’];
return $_params;
}
//END——————————————-
Sorry, the snipped is not the best state of the art, but it works. I only have to find out, how I can get also the slider in the archive page on full with.
Forum: Themes and Templates
In reply to: [Customizr] slider on archive pageThanks for the answer,
Unfortunately the “archive page” is not a “page” or a “post”, it’s like the first page a collection of posts. In the customiztion menu I only can add a slider to the first page (or pages or posts)There must be a snipped like here which I have to add to the functions.php or my archive-africa.php page.