I investigated WordPress hierarchy and have created a php file called category-image-gallery.php the link to this is http://www.phoneographer.org/category/image-gallery/ having uploaded it and added it to my custom menu. I would like to set this as my home page but it’s not listed as a Page in my reading settings screen (because it’s not a static page I guess) so I can’t select it. Is there any way to set this php ‘page’ (I guess page isn’t strictly the correct term) as my home page?
Many thanks.
Skip.
Create a file front-page.php
with the following content:
locate_template( 'category-image-gallery.php', TRUE, TRUE );
That’s all.
For the theme’s functions.php
If you want to restrict the front page content to posts from that category, filter the front page query:
add_action( 'pre_get_posts', 'wpse_74225_frontpage_categories' );
function wpse_74225_frontpage_categories( $query )
{
if ( $query->is_main_query() && is_front_page() )
{
$query->set( 'category_name', 'image-gallery' );
}
return $query;
}
But that would create a copy of your category archive: duplicate content, not a good idea if you want both pages be found in search engines.
To avoid links to that category archive you have to filter 'term_link'
too:
add_filter( 'term_link', 'wpse_74225_category_link', 10, 2 );
function wpse_74225_category_link( $link, $term )
{
if ( 'image-gallery' === $term->slug )
return home_url();
return $link;
}