Plugin Directory

Changeset 1254101


Ignore:
Timestamp:
09/26/2015 07:54:36 PM (11 years ago)
Author:
Studiofreya
Message:

Mute top-level pages

Location:
sf-bootstrap-menu/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sf-bootstrap-menu/trunk/readme.txt

    r1242671 r1254101  
    2323* Multiple menu instances with different parent pages
    2424* Supports up to 3 levels
     25* Mute top-level pages
    2526
    2627== Installation ==
  • sf-bootstrap-menu/trunk/sf-menu-widget.php

    r1242643 r1254101  
    11<?php
    2 
    3 
    42
    53class SfMenuWidget extends WP_Widget
     
    119    $this->defaults = array(
    1210            'title'             => '',
     11            'show_root'         => true,
    1312            'child_of'          => '',
    1413            'exclude'           => '',
    1514            'sort_column'       => '',
    16             'sort_order'        => '',
     15            'sort_order'        => 'ASC',
    1716            'post_status'       => '',
    1817            'title_color'       => '#505050',
     
    9190        $pageids = array();
    9291        foreach($my_includes as $parent) {
    93             array_push($pageids, $parent);
     92       
     93            if (isset($args['show_root']) && $args['show_root'] == 'yes') {
     94                array_push($pageids, $parent);
     95            }
    9496           
    9597            $args_child=array(
     
    134136    $known_params = $this->known_params(0);
    135137    foreach ($known_params as $param) {
    136       if (strlen($instance[$param])) {
     138      if (isset($instance[$param]) && strlen($instance[$param])) {
    137139        $page_options[$param] = $instance[$param];
    138140      }
     
    163165            'child_of' => array('title' => __("Root pages:", $tdom),
    164166                        'desc' => __("List of root page IDs to show", $tdom)),
     167            'show_root' => array('title' => __("Show top-level pages:", $tdom),
     168                          'type' => 'checkbox'),
    165169            'exclude' => array('title' => __("Exclude pages:", $tdom),
    166170                        'desc' => __("List of page IDs to exclude", $tdom)),
     
    225229        $checkval='';
    226230        $desc = '';
    227         if (isset($option['desc']) && $option['desc'])
     231        if (isset($option['desc']) && $option['desc']) {
    228232          $desc = '<br /><small>' . __($option['desc'], $tdom) . '</small>';
     233        }
    229234       
    230235        if (!isset($option['type'])) {
    231             $option['type'] = 'text';
     236            $option['type'] = '';
     237        }
     238       
     239        switch ($option['type']) {
     240            case 'checkbox':
     241              if ($instance[$option_name]) // special HTML and override value
     242                $checkval = 'checked="yes" ';
     243                $param_display[$option_name] = 'yes';
     244              break;
     245            case '':
     246              $option['type'] = 'text';
     247              break;
    232248        }
    233249       
  • sf-bootstrap-menu/trunk/sf-menu.php

    r1252004 r1254101  
    44 * Plugin URI: http://studiofreya.com/sf-bootstrap-menu
    55 * Description: Responsive menu for pages and posts with Bootstrap 3.0
    6  * Version: 1.1
     6 * Version: 1.2
    77 * Author: Studiofreya AS
    88 * Author URI: http://studiofreya.com
Note: See TracChangeset for help on using the changeset viewer.