Prevent post images from being displayed on homepage

April 4, 2009

When using images in your posts, you not always want them to be shown on your blog homepage. How to prevent any images from the post to be displayed on the homepage? It is easy, Simply paste this code in your functions.php file: <?php add_filter('the_content','wpi_image_content_filter',11); function wpi_image_content_filter($content){     if (is_home() || is_front_page()){       $content = preg_replace("/<img[^>]+\>/i”, “”, $content);     }     return $content; } ?>  Read More →

Manually define to show full post or excerpt on your homepage

January 23, 2009

Do you use excerpts or full posts on your blog excerpts? Personnally, I think they’re both good. The only problem is that you can’t, by default, use both excerpts and full posts on your blog homepage. Here’s a code to do it. On your index.php file, replace your current loop by this one:   <?php if (have_posts()) : while (have_posts()) : the_post(); $customField = get_post_custom_values("full"); if (isset($customField[0])) { //Custom field is set, display a full post ... [Read the full story]

Hide the sidebar on your wordpress blog homepage

December 26, 2008

The sidebar is a very important element of your wordpress, but sometimes, you just don’t want it to be displayed on your wordpress homepage. If you’d like to know how to do, it is simple. To hide your sidebar on your blog homepage, edit the index.php file from your theme and find the code following: <?php get_sidebar(); ?> Replace it by the code following: <?php if (!is_front_page()) { get_sidebar(); } ?>  Read More →

Display only one wordpress sticky post on your homepage

November 28, 2008

Do you use WordPress as a CMS instead of a blog? If yes, you’ll probably be interested to know how you can display a single post on your blog homepage. Open your index.php file, and replace your current loop by this one (replacing the stickies category name by the category of your choice) by:     <?php if (have_posts()) : $my_query = new WP_Query('category_name=stickies&showposts=1'); while ($my_query->have_posts()) : $my_query->the_post(); ?> That’s all! Only the latest post is displayed... [Read the full story]

Page 1 of 11