nested toggles in wordpress

-

most themes just offer one set of toggles.

I created my own heli_functions.php that I keep as plugin and use over all my websites

 

Here the Part for nested toggles

maybe you have to edit the $ss = ….. line according to your themes prerequesite, just look in the source-file of one page having a toggle how your theme formats toggles.

[raw]

// for nested toggles as shortcodes within the text

function toggle_function( $atts , $content=null) {
extract( shortcode_atts( array(
‘title’ => ”
), $atts ) );

if (!empty($title)) {$ss=’title=”‘ . $title . ‘” ‘;}
$ss = ‘<h6 class=”toggle”><a href=”#”>’ . $title . ‘</a></h6><div class=”toggle_content” style=”display: none;”><div class=”block”>’;
$ss = $ss . do_shortcode($content). ‘</div></div>’;
// return
return $ss;
}

add_shortcode( ‘toggle1’, ‘toggle_function’ );
add_shortcode( ‘toggle2’, ‘toggle_function’ );
add_shortcode( ‘toggle3’, ‘toggle_function’ );

[/raw]

same with nested divs

[raw]

// for nested DIVS as shortcodes within the text

function div_function( $atts , $content=null) {
extract( shortcode_atts( array(
‘style’ => ”,
‘class’ => ”,
), $atts ) );

if (!empty($class)) {$ss=’class=”‘ . $class . ‘” ‘;}
if (!empty($style)) {$ss.=’style=”‘ . $style . ‘” ‘;}
$ss = ‘<div ‘ . $ss. ‘>’ . do_shortcode($content). ‘</div>’;
// return
return $ss;
}

add_shortcode( ‘div1’, ‘div_function’ );
add_shortcode( ‘div2’, ‘div_function’ );
add_shortcode( ‘div3’, ‘div_function’ );

 

[/raw]

Google-ZENSUR!

Google zensiert meine Homepage ganz ordentlich, es ist mir tw. selber nicht möglich Artikel von mir bei Google zu finden. Desswegen bitte zum Newsletter anmelden und diesen an Freunde oder per Facebook teilen sowie die Suchfunktion innerhalb meiner Website verwenden. Folgen sie mir auch auf Twitter, dort kündige ich wichtige Artikel auch an.

Kommentieren Sie den Artikel

Bitte geben Sie Ihren Kommentar ein!
Bitte geben Sie hier Ihren Namen ein

×