Implementing JS Toggle Boxes for the widgets widget works plugins
-
The JS Toggle Boxes plugin https://aranea.zuavra.net/index.php/19/ is a very useful feature. I’m currently trying to insert it in widgets.php The link lists are causing some trouble, though. I can see all the relevant ids and classes and all in page source, but it seems as if the function calls to JSTB_box_toggle and JSTB_box_init would never be carried out. The [+/-] never appear. I have never written php/js before, so I would very much appreciate some help. I have places the required function call to my themes header.php
CODE:
function widget_links($args) {
global $wpdb;
// Get a list of link categories
echo “< ul >”;
$link_cats = $wpdb->get_results(“SELECT cat_id, cat_name FROM $wpdb->linkcategories”);// Loop through all categories, print cat.headers and [+/-]
foreach ($link_cats as $link_cat) {
$cat_id = $link_cat->cat_id;
echo ‘< li id=”linkcat-‘.$cat_id.'” >’;
echo ‘< h2 >’.$link_cat->cat_name.'< /h2 >’;
function_exists(‘JSTB_box_toggle’)? JSTB_box_toggle(‘[+/-]’, ‘toggle’, ‘Click to toggle’, ‘cookie_link_’ . $cat_id, ‘link_list_’ . $cat_id) :”;// Sublist: Links in current category
echo ‘< ul id=”link_list_’.$cat_id.'” class=”JSTB_shown” >’;
wp_get_links($link_cat->cat_id);
echo “< /ul >”;function_exists(‘JSTB_box_init’)? JSTB_box_init(‘cookie_link_’.$cat_id, ‘JSTB_shown’, ‘link_list_’.$cat_id) :”;
echo “< /li >”;
}echo “< /ul >”;
}
- The topic ‘Implementing JS Toggle Boxes for the widgets widget works plugins’ is closed to new replies.