-
-
Save DerekCaelin/9a5371a6dfc076810483253aec9dc7d2 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: Pod Template | |
PluginURI: https://gist.github.com/Shelob9/7540721 | |
Author: Josh Pollock | |
AuthorURI: http://JoshPress.net | |
Modified by: Derek Caelin | |
*/ | |
function slug_pods_content_filter($content) { | |
if ( get_post_type() == 'tool' ) { | |
$obj = pods('tool', get_the_id() ); | |
return $obj->template('tool').$content; | |
} | |
if ( get_post_type() == 'tooltype' ) { | |
$obj = pods('tooltype', get_the_id() ); | |
return $obj->template('tooltype').$content; | |
} | |
if ( get_post_type() == 'tool-objective' ) { | |
$obj = pods('tool-objective', get_the_id() ); | |
return $obj->template('tool-objective').$content; | |
} | |
if ( get_post_type() == 'support-org' ) { | |
$obj = pods('support-org', get_the_id() ); | |
return $obj->template('support-org').$content; | |
} | |
if ( get_post_type() == 'support-org-type' ) { | |
$obj = pods('support-org-type', get_the_id() ); | |
return $obj->template('support-org-type').$content; | |
} | |
if ( get_post_type() == 'de-post' ) { | |
$obj = pods('de-post', get_the_id() ); | |
return $obj->template('depost').$content; | |
} | |
if ( get_post_type() == 'campaign' ) { | |
$obj = pods('campaign', get_the_id() ); | |
return $obj->template('campaign').$content; | |
} | |
if ( get_post_type() == 'activity-report' ) { | |
$obj = pods('activity-report', get_the_id() ); | |
return $obj->template('activity-report').$content; | |
} | |
return $content; | |
} | |
add_filter( 'the_content', 'slug_pods_content_filter' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment