Can someone advise me on the best course of action please.
I've created a custom wordpress theme for a vet specialising in euthanasia, who wants a simple contact sheet style memorial wall to add clients thumbnail images with just a couple of lines of memorial text.
So i've created a wordpress catalogue, (single-memorial.php) which displays the custom posts on (archive-memorial.php). All good so far...
But I only want the ARCHIVE indexed and viewable. Not the single-memorial.php
In the loop I'm not wrapping the post tiles in any the_permalinks. So the thumbnails aren't linking to the single post data, essentially making the single posts complete orphans, unless of course you guessed the slug and directly found them.
However the single posts will be indexable won't they, which I DON'T want and I'd rather not need to style the single-memorial.php un-necessarily - as I don't want anybody to see them.
With such little information, they wouldn't be relevant pages.
So how can I keep the post data public, so the ARCHIVE will work, but not show the single-memorial.php pages?
I was thinking of some kind of generic 301 redirect in the functions file for any of the single posts using single-memorial.php, to the ARCHIVE or HOME??
I could do a .htaccess redirect, but I'm not sure how I'd target the correct posts, as I won't know the url's the client creates he adds new memorials.
Advice most welcome, thanks in advance.
// Memorials Custom Post Type
function memorials_custom_post() {
$args = array(
'labels' => array(
'name' => 'Memorials',
'singular_name' => 'Memorial'
),
'show_ui' => true,
'show_in_nav_menus' => true,
'has_archive' => true,
'supports' => array(
'title', 'editor', 'thumbnail', 'post-formats'),
'description' => 'Pet memorial catalogue',
'hierarchical' => true,
'show_in_nav_menus' => true,
'exclude_from_search' => true,
'publicly_queryable' => true,
'menu_position' => 23,
'menu_icon' => 'dashicons-format-quote'
);
register_post_type( 'memorial-wall', $args );
}
add_action( 'init', 'memorials_custom_post' );
// Redirect Memorial Single Custom Post
function redirect_single_memorial_post() {
if ( is_singular( 'memorial' )) {
wp_redirect( get_post_type_archive_link( 'memorial-wall' ), 301 );
exit;
}
}
add_action( 'template_redirect', 'redirect_single_memorial_post' );
