Skip to content

Instantly share code, notes, and snippets.

@lucagrandicelli
Created October 24, 2018 11:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucagrandicelli/9d97f5f0ddb0b2305ee56b6bf5ebc857 to your computer and use it in GitHub Desktop.
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.
<?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