php导航栏代码子菜单找不到,php – 下拉导航菜单,显示每个类别的最新帖子

所以我想在我的wordpress网站的导航菜单上工作.我正在尝试从hongkiat.com复制导航菜单(如图所示).

在Hongkiat的导航菜单中,您会看到五(5)个家长类别(设计/开发,技术,灵感,SOCO COMMER和交易).一旦用户徘徊在父类别上,它将显示父类别下的最近帖子.

无论如何,我设法使用父类别显示加上它的子类别代码下拉菜单.现在的困境在于如何显示用户所徘徊的父类别下的最新帖子(至少3个帖子).

5QVGp.jpg

无论如何,这是我的代码:

HTML / PHP

global $post;

$myposts = get_posts('numberposts=3&offset=1');

foreach($myposts as $post) ;

$args = array(

'show_option_all' => '',

'hide_empty' => '0',

'orderby' => 'name',

'order' => 'ASC',

'style' => 'list',

'use_desc_for_title' => 1,

'child_of' => 0,

'hierarchical' => 1,

'title_li' => (''),

'show_option_none' => __( '' ),

'number' => null,

'echo' => 1,

'depth' => 2,

'current_category' => 0,

'pad_counts' => 0,

'taxonomy' => 'category',

'walker' => null

);

wp_list_categories( $args );

?>

CSS

.navone {

display:inline-block;

height:35px;

vertical-align:middle;

margin:0px auto;

font-family: "Raleway",san-serif;

font-feature-settings: normal;

font-kerning: auto;

font-language-override: normal;

font-size: 12px;

font-size-adjust: none;

font-stretch: normal;

font-style: normal;

font-synthesis: weight style;

font-variant: normal;

font-weight: 600 !important;

letter-spacing: 0.03em;

text-transform:uppercase;

}

.navone ul {

margin:0;

padding:0;

}

.navone ul ul {

display: none;

}

.navone ul li:hover > ul {

display: block;

-webkit-transition: all .25s ease;

-moz-transition: all .25s ease;

-ms-transition: all .25s ease;

-o-transition: all .25s ease;

transition: all .25s ease;

}

.navone ul {

list-style: none;

position: relative;

display: inline-table;

}

.navone ul:after {

content: ""; clear: both; display: block;

}

.navone ul li {

float: left;

cursor:pointer;

padding:10px 20px;

}

.navone ul li:hover {

background:#000;

}

.navone ul li:hover a {

color: #fff;

}

.navone ul li a {

display: block;

color: #FFF;

text-decoration: none;

}

.navone ul li ul {

width:200px;

z-index:9;

}

.navone ul ul {

background: #000;

padding: 0;

position: absolute;

top:100%;

left:0;

}

.navone ul ul li {

float: none;

position: relative;

padding:5px 10px;

}

.navone ul ul li a {

color: #fff;

}

.navone ul ul li a:hover {

-webkit-transition: all .25s ease;

-moz-transition: all .25s ease;

-ms-transition: all .25s ease;

-o-transition: all .25s ease;

transition: all .25s ease;

}

.navone ul ul ul {

position: absolute; left: 100%; top:0;

}

.navone ul li ul li {

padding:8px 10px;

-webkit-transition: all .25s ease;

-moz-transition: all .25s ease;

-ms-transition: all .25s ease;

-o-transition: all .25s ease;

transition: all .25s ease;

}

.navone ul li ul li:hover {

border-left:5px solid #F52100;

padding-left:20px;

-webkit-transition: all .25s ease;

-moz-transition: all .25s ease;

-ms-transition: all .25s ease;

-o-transition: all .25s ease;

transition: all .25s ease;

}

.navtwo {

display:inline;

}

如果任何人可以帮助我,或者指出我缺少什么,因为我的代码不起作用.我的代码没有错误,但我没有实现我想要完成的.

任何人都可以伸出援手.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值