UK Expert SEO

Search Engine Optimisation, Promotion, Linkbait & PPC, Online PR

UK Expert SEO header image 2

Wordpress - static content on front page

May 30th, 2007 · No Comments

images.jpgThis is a follow on from my other post on adding static content for search engines :

This is really useful if you want static content on the front page, but you want to run blog posts below the content.

I have had sooo many problems with this. I have tried ‘sticky posts‘ and a number of other plugins to get s ingle static piece of content to just sit there without affecting other parts of the site ( i wont extrapolate, aside that this issue is a pain)

The usual route is to set up an include on the theme above the blog posts. the downer is that this include then repeats itself on the ‘previous articles’ pages and so you get duplicate content…. not good for seo

So here is my fix

I have added this code below

<?php get_header(); ?>
<?php get_sidebar(); ?>

and ive made sure it’s within the div tags theming the content.

<?php if ( $paged < 2 ) { // Do stuff specific to first page?>
<?php if ( is_home() ) : ?>
<div id=”category-description”>
<?php echo get_staticpage(); ?>
</div>
<?php endif; ?>
<?php } else { // Do stuff specific to non-first page ?>
<?php } ?>

I have then set up a page called static-content.php and added the relevant content and saved it within the template files.

and then i have edited :

and function get_staticpage() {
do_action( ‘get_staticpage’ );
if ( file_exists( TEMPLATEPATH . ‘/staticpage.php’) )
load_template( TEMPLATEPATH . ‘/staticpage.php’);
else
load_template( ABSPATH . ‘wp-content/themes/default/staticpage.php’);
}

then i have edited :

wp-includes/general-template.php

and added at the top of the file (below the php tag) :

function get_staticpage() {
do_action( ‘get_staticpage’ );
if ( file_exists( TEMPLATEPATH . ‘/staticpage.php’) )
load_template( TEMPLATEPATH . ‘/staticpage.php’);
else
load_template( ABSPATH . ‘wp-content/themes/default/staticpage.php’);
}

and it should all work !

Tags: Uncategorized

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment