友情链接页面分类显示代码
页面CSS样式如下:
1 2 3 4 5 6 7 8 9 10 | /*友情链接页面*/ .links{overflow:hidden;margin:0px 0 24px;padding:10px;} .links h3{text-align:center;margin:0;} .links ul{margin:0;padding:5px 0 0 0;} .links ul li{float:left;width:150px;line-height:16px;height:16px;margin:5px 5px 0;padding:0;list-style-type:none;} .links ul li:hover{background:#f2f2f2;} .links ul li img{width:16px;height:16px;margin:0 5px -2px 0;padding:0;border:none;} /*友情链接页面*/ |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | <!-- .友联开始 --> <div class="links"> <h3>博友链接</h3> <ul> <?php $default_ico = get_template_directory_uri().'/images/links_default.gif'; //默认 ico 图片位置 $bookmarks = get_bookmarks('title_li=&categorize=0&category=18&orderby=rand'); //如要输出链接分类ID为5的链接 title_li=&categorize=0&category=5&orderby=rand //title_li=&categorize=0&category=5&orderby=rand if ( !empty($bookmarks) ) { foreach ($bookmarks as $bookmark) { echo '<li><img src="', $bookmark-/>link_url , '/favicon.ico" onerror="javascript:this.src=\'' , $default_ico , '\'" /><a href="' , $bookmark->link_url , '" title="' , $bookmark->link_description , '" target="_blank" >' , $bookmark->link_name , '</a>'; } } ?> </ul> </div> <div class="links"> <h3>音乐站点</h3> <ul> <?php $default_ico = get_template_directory_uri().'/images/links_default.gif'; //默认 ico 图片位置 $bookmarks = get_bookmarks('title_li=&categorize=0&category=45&orderby=rand'); // //如要输出链接分类ID为5的链接title_li=&categorize=0&category=5&orderby=rand if ( !empty($bookmarks) ) { foreach ($bookmarks as $bookmark) { echo '<li><img src="', $bookmark-/>link_url , '/favicon.ico" onerror="javascript:this.src=\'' , $default_ico , '\'" /><a href="' , $bookmark->link_url , '" title="' , $bookmark->link_description , '" target="_blank" >' , $bookmark->link_name , '</a>'; } } ?> </ul> </div> <!-- .友联结束 --> |