I have this plugin I created that has a custom post type and a template file that renders the posts. I want to be able to render the template in any page using a short code. So what I created was this piece of code which I am sure is wrong and would totally appreciate it if someone could answer how I am supposed to render the template
function display_timeline(){
ob_start();
locate_template(plugin_dir_path( __FILE__ ) . '/timelines.php', true, false);
$ret = ob_get_contents();
ob_end_clean();
return $ret;
}
add_shortcode( 'wptimeline_display', 'display_timeline' );
Also, the template and the plugin functions are both in the same directory.