示例#1
0
文件: page.php 项目: ngocthangict/edo
 * The template for displaying pages
 *
 * This is the template that displays all pages by default.
 * Please note that this is the WordPress construct of pages and that
 * other "pages" on your WordPress site will use a different template.
 *
 * @package KuteTheme
 * @subpackage edo
 * @since edo 1.0
 */
get_header();
// Default option
$kt_sidebar_are = edo_option('kt_sidebar_are', 'full');
// Page option
$kt_page_layout = edo_get_post_meta(get_the_ID(), 'kt_page_layout', 'none');
$kt_show_page_breadcrumb = edo_get_post_meta(get_the_ID(), 'kt_show_page_breadcrumb', 'show');
if ($kt_page_layout != "none") {
    $kt_sidebar_are = $kt_page_layout;
}
$sidebar_are_layout = 'sidebar-' . $kt_sidebar_are;
if ($kt_sidebar_are == "left" || $kt_sidebar_are == "right") {
    $col_class = "main-content col-xs-12 col-sm-8 col-md-9";
} else {
    $col_class = "main-content page-full-width col-sm-12";
}
?>
<div id="primary" class="content-area <?php 
echo esc_attr($sidebar_are_layout);
?>
">
	<main id="main" class="site-main">
 /**
  * @see Walker::start_el()
  * @since 3.0.0
  *
  * @param string $output Passed by reference. Used to append additional content.
  * @param object $item Menu item data object.
  * @param int $depth Depth of menu item. Used for padding.
  * @param int $current_page Menu item ID.
  * @param object $args
  */
 public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     $indent = $depth ? str_repeat("\t", $depth) : '';
     global $custom_css;
     $this->megamenu_enable = get_post_meta($item->ID, '_menu_item_megamenu_enable', true);
     $this->megamenu_menu_page = get_post_meta($item->ID, '_menu_item_megamenu_menu_page', true);
     $this->megamenu_img_icon = get_post_meta($item->ID, '_menu_item_megamenu_img_icon', true);
     $this->megamenu_color = get_post_meta($item->ID, '_menu_item_megamenu_color', true);
     /**
      * Dividers, Headers or Disabled
      * =============================
      * Determine whether the item is a Divider, Header, Disabled or regular
      * menu item. To prevent errors we use the strcasecmp() function to so a
      * comparison that is not case sensitive. The strcasecmp() function returns
      * a 0 if the strings are equal.
      */
     if (strcasecmp($item->attr_title, 'divider') == 0 && $depth === 1) {
         $output .= $indent . '<li role="presentation" class="divider">';
     } else {
         if (strcasecmp($item->title, 'divider') == 0 && $depth === 1) {
             $output .= $indent . '<li role="presentation" class="divider">';
         } else {
             if (strcasecmp($item->attr_title, 'dropdown-header') == 0 && $depth === 1) {
                 $output .= $indent . '<li role="presentation" class="dropdown-header">' . esc_attr($item->title);
             } else {
                 if (strcasecmp($item->attr_title, 'disabled') == 0) {
                     $output .= $indent . '<li role="presentation" class="disabled"><a href="#">' . esc_attr($item->title) . '</a>';
                 } else {
                     $class_names = $value = '';
                     $classes = empty($item->classes) ? array() : (array) $item->classes;
                     $classes[] = 'menu-item-' . $item->ID;
                     $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item, $args));
                     if ($args->has_children) {
                         $class_names .= ' dropdown';
                     }
                     if ($this->megamenu_enable) {
                         $class_names .= ' dropdown';
                     }
                     if (in_array('current-menu-item', $classes)) {
                         $class_names .= ' active';
                     }
                     if ($this->megamenu_color) {
                         $class_names .= ' custom_css_' . $item->ID;
                     }
                     $class_names = $class_names ? ' class="' . esc_attr($class_names) . '"' : '';
                     $id = apply_filters('nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args);
                     $id = $id ? ' id="' . esc_attr($id) . '"' : '';
                     $output .= $indent . '<li' . $id . $value . $class_names;
                     if ($this->megamenu_color) {
                         $output .= ' data-color="' . $this->megamenu_color . '"';
                         $css = array('item' => 'custom_css_' . $item->ID, 'color' => $this->megamenu_color);
                         if ($custom_css && is_array($custom_css)) {
                             $custom_css[] = $css;
                         } else {
                             $custom_css = array($css);
                         }
                     }
                     $output .= '>';
                     $atts = array();
                     $atts['title'] = !empty($item->title) ? $item->title : '';
                     $atts['target'] = !empty($item->target) ? $item->target : '';
                     $atts['rel'] = !empty($item->xfn) ? $item->xfn : '';
                     // If item has_children add atts to a.
                     if ($args->has_children && $depth === 0) {
                         $atts['data-toggle'] = 'dropdown';
                         $atts['class'] = 'dropdown-toggle';
                         $atts['aria-haspopup'] = 'true';
                     }
                     $atts['href'] = !empty($item->url) ? $item->url : '';
                     $atts = apply_filters('nav_menu_link_attributes', $atts, $item, $args);
                     $attributes = '';
                     foreach ($atts as $attr => $value) {
                         if (!empty($value)) {
                             $value = 'href' === $attr ? esc_url($value) : esc_attr($value);
                             $attributes .= ' ' . $attr . '="' . $value . '"';
                         }
                     }
                     $item_output = $args->before;
                     /*
                      * Glyphicons
                      * ===========
                      * Since the the menu item is NOT a Divider or Header we check the see
                      * if there is a value in the attr_title property. If the attr_title
                      * property is NOT null we apply it as the class name for the glyphicon.
                      */
                     if (!empty($item->attr_title)) {
                         $item_output .= '<a' . $attributes . '><span class="glyphicon ' . esc_attr($item->attr_title) . '"></span>&nbsp;';
                     } else {
                         $item_output .= '<a' . $attributes . '>';
                     }
                     if ($this->megamenu_img_icon) {
                         $file = wp_get_attachment_thumb_url($this->megamenu_img_icon);
                         if ($file) {
                             $imgicon = '<img src="' . esc_url($file) . '" alt="' . $item->title . '" title="' . $item->title . '" />';
                             $item_output .= $imgicon;
                         }
                     }
                     $item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after;
                     $item_output .= '</a>';
                     $item_output .= $args->after;
                     if ($this->megamenu_enable && $this->megamenu_menu_page) {
                         $menu_width = edo_get_post_meta($this->megamenu_menu_page, 'edo_megamenu_width', 800);
                         if (post_type_exists('megamenu')) {
                             $pages = new WP_Query(array('post_type' => 'megamenu', 'p' => $this->megamenu_menu_page));
                         } else {
                             $pages = new WP_Query(array('post_type' => 'page', 'page' => $this->megamenu_menu_page));
                         }
                         $item_output .= '<div style="width:' . esc_attr($menu_width) . 'px;" class="dropdown-menu megamenu menu_page mega-menu-' . $depth . ' p-' . $this->megamenu_menu_page . '">';
                         if ($pages->have_posts()) {
                             ob_start();
                             while ($pages->have_posts()) {
                                 $pages->the_post();
                                 the_content();
                             }
                             $item_output .= ob_get_contents();
                             ob_end_clean();
                             wp_reset_query();
                             wp_reset_postdata();
                         }
                         $item_output .= '</div><!--End Mega-->';
                     }
                     $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);
                 }
             }
         }
     }
 }
示例#3
0
<?php

/**
 * The sidebar containing the main widget area
 *
 * @package KuteTheme
 * @subpackage edo
 * @since edo 1.0
 */
$kt_used_sidebar = edo_option('kt_used_sidebar', 'sidebar-shop');
if (is_page()) {
    $kt_page_used_sidebar = edo_get_post_meta(get_the_ID(), 'kt_page_used_sidebar', 'none');
    if ($kt_page_used_sidebar != "none") {
        $kt_used_sidebar = $kt_page_used_sidebar;
    }
}
?>
<div id="secondary" class="secondary">
	<?php 
if (is_active_sidebar($kt_used_sidebar)) {
    ?>
		<div id="widget-area" class="widget-area" role="complementary">
			<?php 
    dynamic_sidebar($kt_used_sidebar);
    ?>
		</div><!-- .widget-area -->
	<?php 
}
?>

</div><!-- .secondary -->
示例#4
0
<?php

/**
 * The template used for displaying page content
 *
 * @package KuteTheme
 * @subpackage edo
 * @since edo 1.0
 */
?>

<?php 
$kt_show_page_title = edo_get_post_meta(get_the_ID(), 'kt_show_page_title', 'show');
$kt_page_extra_class = edo_get_post_meta(get_the_ID(), 'kt_page_extra_class', 'show');
?>
<article id="post-<?php 
the_ID();
?>
" <?php 
post_class($kt_page_extra_class);
?>
>
    <?php 
if ($kt_show_page_title == 'show') {
    ?>
        <h1 class="page-title"><?php 
    the_title();
    ?>
</h1>
    <?php 
}