<?php /** * Template Name: 友情墙 */ get_header(); ?> <main class="container"> <div class="page-friends page-common row"> <?php if (have_posts()): ?> <?php while (have_posts()) : the_post(); ?> <h1 class="page-title"><?php the_title(); ?></h1> <article class="page-content"> <?php the_content(); ?> </article> <?php endwhile; ?> <?php endif; ?> <style> .clearfix {zoom:1;} .clearfix:after {content:”.”;display:block;visibility:hidden;height:0;clear:both;} .readers-list {list-style:none;} .readers-list *{margin:0;padding:0;} .readers-list li{position:relative;padding:10px;float:left;margin-top:20px!important;} .readers-list li > a { border: 1px solid #eee; display: block; height: 85px; text-align: center; transition:all .5s; background: #f9f9f9; } .readers-list li>a:hover{border-color:#e5e5e5;} .readers-list a:hover em{top:45px;font-size:1.1em;} .readers-list a:hover span{opacity:1;left:50%;} .readers-list img{position:absolute;top:-30px;left:calc(50% - 30px);width:60px;height:60px;border-radius:50%;0px 0px 10px 5px #008EC2;box-shadow:0 0 6px 3px #0081B1;transition:all 1s;background:#fff;} .readers-list a:hover img { -webkit-transform:scale(.7); -moz-transform:scale(.7); -o-transform:scale(.7); -ms-transform:scale(.7); transform:scale(.7); border-radius: 0; } .readers-list em{ position: absolute; top: 60px; -webkit-transform: translateX(-50%); left: 50%; font-style: normal; font-size: 1.2em; color: #818181; transition: all .3s; font-family: Helvetica,Arial,"PingFang SC","Microsoft YaHei","WenQuanYi Micro Hei","tohoma,sans-serif" } .readers-list span { position: absolute; left: 20%; bottom: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: center; -webkit-transform: translateX(-50%); width: calc(100% - 30px); opacity: 0; transition:all .3s; color: #818181; font-family: Helvetica,Arial,"PingFang SC","Microsoft YaHei","WenQuanYi Micro Hei","tohoma,sans-serif" } @media(min-width:768px){ .readers-list li{width:25%;} } @media(max-width:767px){ .readers-list li{width:100%;} } </style> <div> <?php global $wpdb; $qlink="select link_url,link_name,link_image,link_notes,link_description from wp_links where link_visible='Y' order by link_id"; $links = $wpdb->get_results($qlink); if(empty($links)) {echo '<p>暂无友链数据!</p>';} foreach ($links as $comment){ $tmp = "<li><a rel=\"nofollow\" title=".$comment->link_url." target=\"_blank\" href=\"/go?url=".$comment->link_url."\"><img src=".$comment->link_image." alt=\"\"><em>".$comment->link_name."</em><span>".$comment->link_notes."</span></a></li>"; $output1 .= $tmp; } $output1 = "<ul class=\"readers-list clearfix\">".$output1."</ul>"; echo $output1; ?> </div> <?php if(comments_open()){ comments_template(); }else{ echo "<h5>评论已经关闭</h5>"; } ?> </div> </main> <?php get_footer(); ?>
转载请注明:邓先生工作室 » 分享 » WordPress自定义友情链接页面模板
发表评论