Skip to content

Commit

Permalink
feat: remove resources from Polylang
Browse files Browse the repository at this point in the history
  • Loading branch information
greatislander committed Mar 11, 2020
1 parent ab499a8 commit 264aaa2
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions includes/functions/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ function setup() {
add_filter( 'mce_css', $n( 'mce_css' ) );
// Hook to allow async or defer on asset loading.
add_filter( 'script_loader_tag', $n( 'script_loader_tag' ), 10, 2 );
// Ensure resources and topics are translatable.
add_filter( 'pll_get_post_types', $n( 'add_resource_to_pll' ), 10, 2 ); // TODO: Remove this.
// Ensure taxonomies are translatable.
add_filter( 'pll_get_post_types', $n( 'remove_resource_from_pll' ), 10, 2 );
add_filter( 'pll_get_taxonomies', $n( 'add_coop_type_to_pll' ), 10, 2 );
add_filter( 'pll_get_taxonomies', $n( 'add_sector_to_pll' ), 10, 2 );
add_filter( 'pll_get_taxonomies', $n( 'add_region_to_pll' ), 10, 2 );
Expand Down Expand Up @@ -144,19 +144,15 @@ function resource_init() {
}

/**
* Add the `lc_resource` post type to Polylang, ensuring it is translatable.
* Remove the `lc_resource` post type from Polylang.
*
* @param array $post_types An array of post types.
* @param bool $is_settings Whether or not we are on the settings page.
*
* @return array
*/
function add_resource_to_pll( $post_types, $is_settings ) {
if ( $is_settings ) {
unset( $post_types['lc_resource'] );
} else {
$post_types['lc_resource'] = 'lc_resource';
}
function remove_resource_from_pll( $post_types, $is_settings ) {
unset( $post_types['lc_resource'] );
return $post_types;
}

Expand Down

0 comments on commit 264aaa2

Please sign in to comment.