18910140161

wordpress模板制作之制作index.php

顺晟科技

2019-08-16 15:31:27

412

制作index.php,

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

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

<?php endwhile; ?>

<?php else : ?>

<?php endif; ?>

标题:<a href=”<?php the_permalink() ?>”><?php the_title_attribute(); ?></a>

调用文章内容:

<?php the_content(“Read More…”); ?>

调用文章内容摘要:

<?php the_excerpt(“Read More…”); ?>

作者:<?php the_author_posts_link(); ?>

日期:<?php the_time(‘F d, Y’) ?>

<?php the_time(‘m-d’) ?>

<?php the_date_xml()?>

评论调用:<?php comments_number(‘No Comment’, ‘1 Comment’, ‘% Comments’ );?>

文章所属分类:标签:<?php the_category(‘, ‘) ?>

上一页,下一页调用:

<div style=”float:left”><?php previous_post_link(‘&laquo; %link’); ?></div>

<div style=”float:right”><?php next_post_link(‘%link &raquo;’); ?></div>

制作single.php页面,加入评论

在single.php中调用<?php endwhile; ?>和<?php else : ?>中间让入

<?php comments_template(); ?>

制作page.php,archive.php,404.php

Page.php和single.php一样

archive.php和index.php一样

制作小工具

添加functions.php,

<?php

if ( function_exists(‘register_sidebar’) )

register_sidebar(array(

‘before_widget’ => ‘<div class=”sidebox”> ‘,

‘after_widget’ => ‘</div>’,

‘before_title’ => ‘<h2>’,

‘after_title’ => ‘</h2>’,

));

?>

在sidebar.php中模块最上面插入:

<?php if ( !function_exists(‘dynamic_sidebar’)

|| !dynamic_sidebar() ) : ?>

Sidebar最下面,添加<?php endif; ?>

相关文章
我们已经准备好了,你呢?
2024我们与您携手共赢,为您的企业形象保驾护航