Last active
June 27, 2018 19:59
-
-
Save Shelob9/7540721 to your computer and use it in GitHub Desktop.
This is an example of how to append Pods Templates to content in a custom post type. For an automated version of this see: https://github.com/pods-framework/pods-frontier-auto-template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Pets Template | |
PluginURI: https://gist.github.com/Shelob9/7540721 | |
Author: Josh Pollock | |
AuthorURI: http://JoshPress.net | |
*/ | |
//Be sure to change 'pets' on line 6 and 9 to your cpt and template names. | |
function slug_pets_content_filter($content) { | |
if ( get_post_type() == 'pets' ) { | |
$obj = pods('pets', get_the_id() ); | |
return $obj->template('pets').$content; | |
} | |
return $content; | |
} | |
add_filter( 'the_content', 'slug_pets_content_filter' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment