Skip to content

Instantly share code, notes, and snippets.

@wpexplorer
Created November 8, 2021 00:07
Show Gist options
  • Save wpexplorer/abe1a77e3ae7758271e41ab18d3a9698 to your computer and use it in GitHub Desktop.
Save wpexplorer/abe1a77e3ae7758271e41ab18d3a9698 to your computer and use it in GitHub Desktop.
Slider revolution - post template for different post types
// Set slider template ID based on post type.
add_filter( 'get_post_metadata', function ( $value, $post_id, $meta_key, $single ) {
if ( $meta_key === 'slide_template' ) {
$post_type = get_post_type( $post_id );
switch ( $post_type ) {
case 'post':
$value = 56; // change this to the template you want for this post type.
break;
case 'page':
$value = 56; // change this to the template you want for this post type.
break;
}
}
return $value;
}, 10, 4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment