Habe eine Seite mit Toggles im Aufbau, da kann ich nur Einstellen
Toggle Multiple (Accordion) oder Toggle Single
und
Open Toggle Index
Index of the toggle will be open. If you want your first toggle to be open enter 0. If you want all toggles to be closed enter -1.
(und Boxed Layout ja/nein und Use Shadow ja/nein)
Ich würde gerne das alle Toggles auf sind und nicht immer nur eine. Habe dem Entwickler gefragt, der meint das ist nicht vorgesehen, aber wenn ich das unbedingt gerne hätte solle ich den Code eben modifizieren. Nur leider weiß ich nicht wie das geht, könnt ihr mir helfen?
Code
[/*
** Toggles Shortcode
*/
if(!function_exists('rockthemes_shortcode_make_toggles')){
function rockthemes_shortcode_make_toggles($atts, $content = null){
//toggle_type refers to "single-mode" or "multiple-mode"
extract( shortcode_atts( array(
'toggle_type' => 'single-mode',
'open_toggle_index' => '0',
'boxed_layout' => 'false'
), $atts ) );
if(isset($GLOBALS['rockthemes_toggles'])){
$GLOBALS['rockthemes_toggles']++;
}else{
$GLOBALS['rockthemes_toggles'] = 1;
}
$GLOBALS['rockthemes_toggles_open_counter'] = 0;
$GLOBALS['rockthemes_open_toggle_index'] = intval(is_int(intval($open_toggle_index)) ? $open_toggle_index : 0);
$id = 'rock-toggles-'.$GLOBALS['rockthemes_toggles'];
$toggles_single_data = do_shortcode($content);
$return = '';
if($boxed_layout == "true") $return .= '';
$return .= '';
$return .= $toggles_single_data;
$return .= '';
if($boxed_layout == "true") $return .= '';
$script = '
jQuery(document).ready(function(){
jQuery(document).on("click", "#'.$id.' .rock-toggle-header", function(e){
';
if($toggle_type == 'multiple-mode'){
$script .= '
if(jQuery(this).parent().hasClass("active") && jQuery(this).parent().find(".rock-toggle-content").css("display") != "none") return;
jQuery("#'.$id.' .active .rock-toggle-content").slideToggle(280);
jQuery("#'.$id.' .active .rock-toggle-header .main-toggle-icon").removeClass("fa fa-chevron-up");
jQuery("#'.$id.' .active .rock-toggle-header .main-toggle-icon").addClass("fa fa-chevron-down");
jQuery("#'.$id. ' .active").removeClass("active");
jQuery(this).parent().addClass("active");
jQuery(this).parent().find(".rock-toggle-content").slideToggle(280);
jQuery(this).parent().find(".rock-toggle-header .main-toggle-icon").removeClass("fa fa-chevron-down");
jQuery(this).parent().find(".rock-toggle-header .main-toggle-icon").addClass("fa fa-chevron-up");
';
}else{
$script .= '
if(jQuery(this).parent().hasClass("active")){
jQuery(this).parent().removeClass("active");
jQuery(this).parent().find(".rock-toggle-header .main-toggle-icon").removeClass("fa fa-chevron-up");
jQuery(this).parent().find(".rock-toggle-header .main-toggle-icon").addClass("fa fa-chevron-down");
}else{
jQuery(this).parent().addClass("active");
jQuery(this).parent().find(".rock-toggle-header .main-toggle-icon").removeClass("fa fa-chevron-down");
jQuery(this).parent().find(".rock-toggle-header .main-toggle-icon").addClass("fa fa-chevron-up");
}
jQuery(this).parent().find(".rock-toggle-content").slideToggle(280);
';
}
$script .='
});
});
';
return $return.$script;
}
}
add_shortcode("rockthemes_toggles", "rockthemes_shortcode_make_toggles");
if(!function_exists('rockthemes_shortcode_make_toggles_single')){
function rockthemes_shortcode_make_toggles_single($atts, $content = null){
extract( shortcode_atts( array(
'title' => 'Toggle New',
'use_shadow' => 'false',
'icon_class' => '',
'icon_url' => ''
), $atts ) );
$use_icon = false;
$use_url = false;
$icon_html = '';
$icon_url_html = '';
if($icon_class != ""){
$icon_html = '';
$use_icon = true;
}
if($icon_url != ""){
$icon_html = '';
$use_icon = true;
}
$ref_id = 'toggles-'.$GLOBALS['rockthemes_toggles'];
if($use_shadow == 'true'){
$shadow_code = '';
}else{
$shadow_code = '';
}
$return = '';
if($GLOBALS['rockthemes_toggles_open_counter'] === $GLOBALS['rockthemes_open_toggle_index']){
$return .= '';
$return .= ''.($use_icon ? $icon_html : '').''.$title.'';
$return .= '';
$return .= $shadow_code;
$return .= ''.rock_check_p($content).'';
}else{
$return .= '';
$return .= ''.($use_icon ? $icon_html : '').''.$title.'';
$return .= '';
$return .= $shadow_code;
$return .= ''.rock_check_p($content).'';
}
$return .= '';
$GLOBALS['rockthemes_toggles_open_counter']++;
return $return;
}
}
add_shortcode("rockthemes_toggles_single","rockthemes_shortcode_make_toggles_single");
/*
** End of Toggles Shortcode
*/
Alles anzeigen