修改二级菜单类名
wp-includes/class-walker-nav-menu.php 42-103行
修改后
/**
* Starts the list before the elements are added.
*
* @since 3.0.0
*
* @see Walker::start_lvl()
*
* @param string $output Used to append additional content (passed by reference).
* @param int $depth Depth of menu item. Used for padding.
* @param stdClass $args An object of wp_nav_menu() arguments.
*/
public function start_lvl( &$output, $depth = 0, $args = array() ) {
if( $depth == 0 ){
$output .= '<ul class="submenu">';
}else{
$output .= '<ul class="san-ul">';
}
}
/**
* Ends the list of after the elements are added.
*
* @since 3.0.0
*
* @see Walker::end_lvl()
*
* @param string $output Used to append additional content (passed by reference).
* @param int $depth Depth of menu item. Used for padding.
* @param stdClass $args An object of wp_nav_menu() arguments.
*/
public function end_lvl( &$output, $depth = 0, $args = array() ) {
if( $depth == 0 ){
$output .= "</ul>";
}else{
$output .= '</ul>';
}
}
修改前
调用当前栏目子分类
<?php
$categories = get_categories($args);
foreach ($categories as $category) { ?>
<?php
$argszi = array(
'child_of' => $category->term_id,
'parent' => $category->term_id,
'hide_empty' => '0',
'orderby' => 'ID',
'order' => 'ASC',
);
$categorieszi = get_categories($argszi);
foreach ($categorieszi as $categoryzi) {
?>
<div class="col-md-4 lpcol1">
<a href="<?php echo get_category_link($categoryzi->term_id); ?>">
<?php echo $categoryzi->name; ?>
</a>
</div>
<?php }
}
?>
调用上一篇下一篇标题和链接
<?php
$prev_post = get_previous_post(true, '', 'category');
if (!empty($prev_post)) : ?>
<a href="<?php echo get_permalink($prev_post->ID); ?>">
<div class="zb">
<div class="circle">
<i class="iconfont icon-zuojiantou"></i>
</div>
</div>
<div class="nytxt">
<?php echo $prev_post->post_title; ?>
</div>
</a>
<?php endif; ?>
</div>
<div class="fr">
<?php
$next_post = get_next_post(true, '', 'category');
if (!empty($next_post)) : ?>
<a href="<?php echo get_permalink($next_post->ID); ?>">
<div class="nytxt">
<?php echo $next_post->post_title; ?>
</div>
<div class="zb">
<div class="circle">
<i class="iconfont icon-youjiantou"></i>
</div>
</div>
</a>
<?php endif; ?>
调用分类名称和图片
<img src="<?php $thiscat = get_category($cat); if (function_exists('z_taxonomy_image_url')) echo z_taxonomy_image_url(salong_category_top_parent_id ($thiscat)); ?>" alt="" class="w100">
<?php $thiscat = get_category($cat);
echo $thiscat->name;
?>
相册功能:插件Advanced Custom Fields 专业版
字段-相册功能
<?php
$photolist = get_post_meta($post->ID, 'imglist1', true);
?>
<ul class="clearfix proul">
<?php if ($photolist) { ?>
<?php foreach ($photolist as $v) { ?>
<li class="fl proli">
<div class="cont">
<img src="<?php echo wp_get_attachment_url($v); ?>" alt="" class="w100">
<div class="content">
<div class="name">
<?php echo wp_get_attachment_caption($v); ?>
<!-- 调用图片的说明文字 caption-->
</div>
<!-- <div class="circle">
<i class="iconfont icon-youjiantou"></i>
</div> -->
</div>
</div>
</li>
<?php } ?>
<?php } ?>
</ul>