我知道如何添加滚动效果,我只需要帮助我如何编写一页。php模板,我可以通过它处理div的不同主题,即关于、事件。。。每个div都有不同的布局&;背景色。。
对div进行硬编码并不是解决方案。。我还可以动态地将div添加到主页。。但主要问题是如何处理每个div的不同布局?
现在使用此作为我的主页模板
<?php
/*
Template Name: Home Page
*/
get_header();
?>
<div id="container">
<a name="top"></a>
<?php
$args = array(
\'sort_order\' => \'ASC\',
\'sort_column\' => \'menu_order\', //post_title
\'hierarchical\' => 1,
\'child_of\' => 0,
\'parent\' => -1,
\'exclude_tree\' => \'6\',
\'number\' => \'\',
\'offset\' => 0,
\'post_type\' => \'page\',
\'post_status\' => \'publish\'
);
$pages = get_pages($args);
//start loop
foreach ($pages as $page_data) {
$content = apply_filters(\'the_content\', $page_data->post_content);
$title = $page_data->post_title;
$slug = $page_data->post_name;
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id( $page_data->ID ), \'index-post-thumbnail\' );
?>
<div class=\'page\' id=\'<?php echo "$slug" ?>\'><a name=\'<?php echo "$slug" ?>\'></a>
<div class="page-content">
<h2 class="entry-title"><?php echo "$title" ?></h2>
<?php echo $content; ?>
</div>
<div class="page-featuredImage">
<img src="<?php echo $thumb[0]; ?>" />
</div>
</div>
<?php } ?>
<?php get_footer(); ?>