Ok so i put the above template name at the top of my gallery.php as described above.
But i dont get the option to select this as a page template under manage pages.
I've had this problem before and couldn't resolve it. Thats why i changed to using the default hierarchy descibed in the above link.
I am confident that i dont have any errors in my code. because i have had this page working previously.
here is my code so far
/*
Template name: gallery
*/
<?php get_header(); ?>
<div id="main-nav">
<li><a href="<?php bloginfo('url'); ?>/">home </a></li>|
<li><a href="<?php bloginfo('url'); ?>/our-services">our services </a></li>|
<li><a href="<?php bloginfo('url'); ?>/gallery" class="active">gallery </a></li>|
<li><a href="<?php bloginfo('url'); ?>/training">training </a></li>|
<li><a href="<?php bloginfo('url'); ?>/solutions">solutions </a></li>|
<li><a href="<?php bloginfo('url'); ?>/contact">contact</a></li>
</div>
<div id="sidebar-left_archive">
<div class="headers">
Gallery
</div>
<div id="cat_buffer">
<?php wp_list_cats('sort_column=name&optioncount=1&hierarchical=0&hide_empty=0&exclude=1, 5, 6, 7, 8'); ?>
<p>
<div class="headers2">
Tags
</div>
<?php wp_tag_cloud('smallest=10&largest=10&number=30&orderby=count&format=list'); ?>
</div>
</div>
<div id="content_archive">
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("cat=8&showposts=4&paged=$paged");?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="entry <?php if(is_home() && $post==$posts[0] && !is_paged()) echo ' firstpost';?>">
<!--<div class="date"><p><span class="month"><?php the_time('M') ?></span><span class="day"> <?php the_time('j') ?> </span></p></div>-->
<h3 class="etitle" id="post-<?php the_ID(); ?>"> <a href="<?php the_permalink() ?>" rel="bookmark">
<?php the_title(); ?>
</a> </h3>
<div class="emeta">
<?php //the_time('F dS, Y');
echo " Category: ";the_category(' | ');?>
</div>
<div class="ebody">
<?php the_content();?>
</div>
<?php trackback_rdf(); ?>
</div>
<?php comments_template(); // Get wp-comments.php template ?>
<?php endwhile; else: ?>
<p>
<?php _e('Sorry, no posts matched your criteria.'); ?>
</p>
<?php endif; ?>
<p>
<?php posts_nav_link(' — ', __('« Older Work'), __('Newer Work »')); ?>
</p>
</div>
<div id="footer">
<div class="testimonials">
<?php
global $customFields;
$customFields = "'testimonial'";
$customPosts = new WP_Query();
add_filter('posts_join', 'get_custom_field_posts_join');
add_filter('posts_groupby', 'get_custom_field_posts_group');
$customPosts->query('showposts=1&orderby=rand' );//Uses same parameters as query_posts
remove_filter('posts_join', 'get_custom_field_posts_join');
remove_filter('posts_groupby', 'get_custom_field_posts_group');
while ($customPosts->have_posts()) : $customPosts->the_post();
$testimonial = get_post_custom_values("testimonial");
?>
<li><a href="<?php the_permalink() ?>" class="test1"><?php echo $testimonial[0]; ?></a></li>
<?php endwhile; ?>
<li><img src="/Client1953/wp-content/themes/T2_main_theme/images/autodesk.png" /></li>
<?php
global $customFields;
$customFields = "'testimonial'";
$customPosts = new WP_Query();
add_filter('posts_join', 'get_custom_field_posts_join');
add_filter('posts_groupby', 'get_custom_field_posts_group');
$customPosts->query('showposts=1&orderby=rand' );//Uses same parameters as query_posts
remove_filter('posts_join', 'get_custom_field_posts_join');
remove_filter('posts_groupby', 'get_custom_field_posts_group');
while ($customPosts->have_posts()) : $customPosts->the_post();
$testimonial = get_post_custom_values("testimonial");
?>
<li><a href="<?php the_permalink() ?>" class="test1"><?php echo $testimonial[0]; ?></a></li>
<?php endwhile; ?>
</div>
<div class="icons">
<li><a href="/news" class="news">News</a></li>
<li><a href="/autotrain" class="autotrain">autotrain</a></li>
<li><a href="" class="forum">forum</a></li>
<li><a href="" class="tutorials">tutorials</a></li>
<li><a href="" class="blog">blog</a></li>
</div>
</div>
</div>
<?php get_footer(); ?>