Skip to main content

Ivan Teoh

Something personal yet public

102-index.php

(Source)

<?php
/**
 * @package WordPress
 * @subpackage Your_Theme
 */
/*
Template Name: Home
*/
get_header(); ?>
<div id="container">
<div id="content">
<div class="entry-title">
<h2>Welcome</h2>
</div><!-- .entry-title -->
<div class="entry-content">
<p>This place for sharing the things that I know. Hope you guys like it.</p>
</div><!-- .entry-content -->
<div class="entry-title">
<h2><a href="./blog/" title="Blog">Blog</a>: What's Fresh</h2>
</div><!-- .entry-title -->
<div class="entry-content">
<ul>
<?php
$how_many=8; //How many posts do you want to show
$news=$wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts
    WHERE `post_type`=\"post\" AND `post_status`= \"publish\" ORDER BY
    `post_date` DESC LIMIT $how_many");
 foreach($news as $np){
    printf ("<li><a href=\"index.php?p=%s\">%s</a></li>",
    $np->ID,$np->post_title);
}
?>
</ul>
</div><!-- .entry-content -->
<?php
$number_of_pic=18;
$Width=60;
$Height=60;
if (function_exists("nggDisplayRandomImages")) {
?>
<div class="entry-title">
<h2><a href="./gallery/" title="Gallery">Gallery</a>: Random Images</h2>
</div><!-- .entry-title -->
<?php
    nggDisplayRandomImages($number_of_pic,$Width,$Height);
}
?>
</div><!-- #content -->
</div><!-- #container -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>