多多色-多人伦交性欧美在线观看-多人伦精品一区二区三区视频-多色视频-免费黄色视屏网站-免费黄色在线

國內最全IT社區平臺 聯系我們 | 收藏本站
阿里云優惠2
您當前位置:首頁 > php開源 > 綜合技術 > WordPress主題的index.php代碼

WordPress主題的index.php代碼

來源:程序員人生   發布時間:2014-01-26 01:02:47 閱讀次數:4697次

  建站學院(LieHuo.Net)訊 在以前的文章中我們介紹了的,這篇教程介紹一下主題index.php代碼,它是生成的是網站首頁顯示的內容,還是以默認模板default為例。下面是index.php的完整代碼:

以下為引用的內容:

  

   <div id="content" class="narrowcolumn">

   <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>

     <div <?php post_class(); ?> id="post-<?php the_ID(); ?>">

      <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'kubrick'), the_title_attribute('echo=0')); ?>"><?php the_title(); ?></a></h2>

      <small><?php the_time(__('F jS, Y', 'kubrick')) ?> <!-- by <?php the_author() ?> --></small>

      <div class="entry">

       <?php the_content(__('Read the rest of this entry &raquo;', 'kubrick')); ?>

      </div>

      <p class="postmetadata"><?php the_tags(__('Tags:', 'kubrick') . ' ', ', ', '<br />'); ?> <?php printf(__('Posted in %s', 'kubrick'), get_the_category_list(', ')); ?> | <?php edit_post_link(__('Edit', 'kubrick'), '', ' | '); ?>  <?php comments_popup_link(__('No Comments &#187;', 'kubrick'), __('1 Comment &#187;', 'kubrick'), __('% Comments &#187;', 'kubrick'), '', __('Comments Closed', 'kubrick') ); ?></p>

     </div>

    <?php endwhile; ?>

    <div class="navigation">

     <div class="alignleft"><?php next_posts_link(__('&laquo; Older Entries', 'kubrick')) ?></div>

     <div class="alignright"><?php previous_posts_link(__('Newer Entries &raquo;', 'kubrick')) ?></div>

    </div>

   <?php else : ?>

    <h2 class="center"><?php _e('Not Found', 'kubrick'); ?></h2>

    <p class="center"><?php _e('Sorry, but you are looking for something that isn&#8217;t here.', 'kubrick'); ?></p>

    <?php include (TEMPLATEPATH . "/searchform.php"); ?>

   <?php endif; ?>

   </div>

  <?php get_sidebar(); ?>

  <?php get_footer(); ?>

<?php get_header(); ?>

  先說下三個函數get_header(); get_sidebar(); get_footer();分別輸出各自的模板代碼如header.php、sidebar.php、footer.php;相應的模板代碼生成后加入相應位置。

  第5行的if (have_posts()) : 為判斷是否含有日志;

  第7行的 while (have_posts()) : 為當有日志時,進行循環操作;the_post(); 為對單個循環中的一篇日志進行操作。

  第9行:post_class();輸出個性化的日志class——官方參考例如置頂文章回輸出不同的class,可以加入參數自定義生成的類名如:post_class(’myclass’);;the_ID();生成日志id數字號。

  第10行:the_permalink()為每篇日志對應內容頁的鏈接,the_title();為日志標題;

  第11行:the_time(__(’F jS, Y’, ‘kubrick’)為日志發布時間;

  第14行:the_content(__(’Read the rest of this entry »’, ‘kubrick’));為日志內容;

  第17行:the_tags(__(’Tags:’, ‘kubrick’) . ‘ ‘, ‘, ‘, ‘<br />’); 為日志所在標簽;printf(__(’Posted in %s’, ‘kubrick’), get_the_category_list(’, ‘));為日志所在分類;

  第20行: endwhile; 結束循環;

  第23行: next_posts_link(__(’« Older Entries’, ‘kubrick’))上一篇日志鏈接;

  第24行: previous_posts_link(__(’Newer Entries »’, ‘kubrick’)) ?>下一篇日志鏈接;

  第27行: else : 為沒有日志時候的情況,

  第29行:php _e(’Not Found’, ‘kubrick’);為沒有發現日志

  第30行:php _e(’Sorry, but you are looking for something that isn’t here.’, ‘kubrick’);為相關提示;

  第31行:include (TEMPLATEPATH . “/searchform.php”);插入搜索表單模板;

  第33行:endif;結束判斷。

生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關閉
程序員人生
主站蜘蛛池模板: 国产欧美综合在线 | 偷拍自拍校园春色 | 男女免费观看在线爽爽爽视频 | 性做久久久久久免费观看 | 国产亚洲精品资源在线26u | 国产久视频观看 | 国产福利视频一区二区三区 | 一级毛片在线视频 | 免费v片在线观看 | 中文字幕35页 | 日本卡1卡2卡4卡免费 | 亚洲午夜精品久久久久久成年 | 久久久久免费精品国产 | 欧美一级www | 黑人最猛性free护士hd | 亚洲天堂视频网 | 国产免费福利体检区久久 | 一级毛片在线观看视频 | 精品成人一区二区三区免费视频 | 亚1州区2区三区4区产品 | 性欧美在线 | 欧美一区精品二区三区 | 国产青草亚洲香蕉精品久久 | 在线免费日本 | 欧美毛片在线观看 | 国产三级精品三级在线专区1 | 亚洲性69影院在线观看 | 中文字幕之中文字幕 | 国产精品免费一区二区三区 | 成熟女人免费一级毛片 | 国产成人青草视频 | 欧美激情性xxxxx | 日本网站在线看 | 亚洲精品一区二区三区五区 | 亚洲网站免费 | 国产片在线观看 | 亚欧美色| 欧美黑人巨大videos精 | 黄站在线观看 | 欧美xx毛片免费看 | 爱爱网网站免费观看 |