Created
July 5, 2020 09:39
-
-
Save ivanteoh/20f60a38f39a2e0a2e3591a5faae1038 to your computer and use it in GitHub Desktop.
WordPress Theme Development 18 - Home Page Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment