Created
October 24, 2018 11:14
-
-
Save lucagrandicelli/9d97f5f0ddb0b2305ee56b6bf5ebc857 to your computer and use it in GitHub Desktop.
How to enable YARPP (Yet Another Related Posts Plugin) support for Toolset's Custom Post Types.
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 | |
/** | |
* Enable YARPP support for Toolset's Custom Post Types | |
* | |
* @param $data array The CPT args. | |
* @param $post_type array The registered CPT list. | |
* | |
* @return array | |
*/ | |
function yarpp_support_func($data, $post_type) { | |
// Checking if our custom post type exists. | |
if(in_array($post_type, array('fotografia'))) { | |
// Adding the YARPP support. | |
$data['yarpp_support'] = true; | |
} | |
// Returning data set. | |
return $data; | |
} | |
// Adding Wordpress filter hook. | |
add_filter('wpcf_type', 'yarpp_support_func', 10, 2); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment