偶尔在使用WORDPRESS制作网站的时候,总免除不了需要用到文章调用、图片调用等情况;想起以前的时候自己使用WORDPRESS完全构建过一个行业网站的基础,如果没有看过的,可以点击查阅下方文章链接,将原来用到的一些代码汇集一下,方便日后的自己使用;
在=<li>您好,欢迎来到<?php bloginfo(‘name’); ?>!</li> <?php if (current_user_can('manage_options')) { echo '<li id="topreg"><a href="' . admin_url() . '" target="_blank">'.sprintf(__( '[管理站点">', 'begin' )).'</a></li>'; } else { echo '<li id="topreg"><a href="' .get_permalink( zm_get_option('user_url') ) . '" target="_blank">'.sprintf(__( '用户中心', 'begin' )).'</a></li>'; } ?> <li id="topreg"><a href="<?php echo wp_logout_url('index.php'); ?>"><?php _e( '[登出">', 'begin' ); ?></a></li>
<?php if (zm_get_option('nav_no')) { ?> <li><a href="/" class="now"><span class="out" style="top: 48px;">网站首页</span></a></li> <?php } ?> <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'down-menu nav-menu', 'fallback_cb' => 'default_menu' ) ); ?>
<ul class="jdsjph martop10"> <?php $args=array( 'cat' => 26, 'posts_per_page' => 7, ); query_posts($args); if(have_posts()) : while (have_posts()) : the_post(); ?> <li> <em class="jdicowjqy sanjiao_ico"></em> <a target="_blank" title="<?php the_title();?>" href="<?php the_permalink(); ?>"><?php the_title();?></a> <span class="color95">VIP</span> </li> <?php endwhile; endif; wp_reset_query(); ?> </ul>
// 小工具 if (function_exists('register_sidebar')){ register_sidebar( array( 'name' => '博客布局侧边栏', 'id' => 'sidebar-h', 'description' => '显示在首页博客布局侧边栏', 'before_widget' => '<aside id="%1$s" class="widget %2$s wow fadeInUp" data-wow-delay="0.3s">', 'after_widget' => '<div class="clear"></div></aside>', 'before_title' => '<h3 class="widget-title"><span class="title-i"><span class="title-i-t"></span><span class="title-i-b"></span><span class="title-i-b"></span><span class="title-i-t"></span></span>', 'after_title' => '</h3>', ) ); );
<!--推荐产品 --> <div class="layui-tab-item jdul jdcp layui-show"> <ul> <?php $args=array( 'cat' => 5, 'posts_per_page' => 10, ); query_posts($args); if(have_posts()) : while (have_posts()) : the_post(); ?> <li> <?php if (zm_get_option('lazy_s')) { zm_long_thumbnail_h(); } else { zm_long_thumbnail(); } ?> <?php the_title( sprintf( '<h2 class="picture-h-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?> </li> <?php endwhile; endif; wp_reset_query(); ?> </ul> </div> <!--推荐产品 -->
<?php if (zm_get_option('footer_link')) { ?> <?php get_template_part( 'template/footer-links' ); ?> <?php } ?>