You are on page 1of 3

Change the home page as my custom page

Settings --> Reading, Static Page


To make in ascending order
<?php query_posts('order=ASC'); ?>
To create a template
<?php
/*
Template Name: Snarfer
*/
?>
How to call a post by category name
<?php query_posts('category_name=who-right');
while (have_posts()) :
the_post();
$queried_post = get_po
st($post_id);
?><li id="entry"><?php
echo $queried_post->post_content;?></li>
<?php endwhile;?>

How to call a content based on different pages


<?php if (is_home()) {}
elseif (is_page_template('Contact Us.php')) {
}
else
{
?>
HOw to call a js
<script type="text/javascript" src="<?php bloginfo
('template_directory'); ?>/js/jQuery v1.7.1.js"></
script>
How to derive a permalink

<a href="<?php the_permalink(); ?>">


HOw to display featured image
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail();?>
How to set a template for a particular category
if ( in_category('Portfolio')) {
include(TEMPLATEPATH . '/kairos.php');
} else {
}
How to display only the custom field of a particula
r category
if (in_category($pagename)) {
if ( $keys = get_post
_custom_keys() ) {
echo "<ul class='post-meta'>\n";
foreach ( (array) $keys as $key ) {
$keyt = trim($key);
if ( is_protected_meta( $keyt,'post' )
)
continue;
$values = array_map('trim',get_post_cus
tom_values($key));
$value='<span>'.$value.'</span>';
$value = "<li>".implode('</li><li>',$va
lues)."</li>";
echo apply_filters('the_meta_key', "<d
iv class='inner_drop'><div class='$key'><span clas
s='post-meta-key'>$key:</span></div><ul class='$ke
y'>$value</ul></div>\n", $key, $value);
}
echo "</ul>\n";

}?>
<?php }?>

You might also like