Skip to content

Commit

Permalink
Merge pull request #14 from ItinerisLtd/remove_customizer_support
Browse files Browse the repository at this point in the history
remove customizer support
  • Loading branch information
yarovikov authored Mar 14, 2023
2 parents 5f27ff8 + ba0bc5a commit 2711152
Showing 1 changed file with 0 additions and 44 deletions.
44 changes: 0 additions & 44 deletions src/Types/CustomPostType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Itineris\PageAsPostTypeArchive\Types;

use WP_Customize_Manager;
use WP_Post;
use WP_Post_Type;

Expand All @@ -26,7 +25,6 @@ public function __construct()
add_filter('wpseo_breadcrumb_links', [$this, 'breadcrumbLinks']);
add_action('template_redirect', [$this, 'customTemplate']);
add_action('admin_init', [$this, 'addCustomPostTypePageSelectorOptions']);
add_action('customize_register', [$this, 'customizerRegister']);
add_action('deleted_post', [$this, 'deletedPost']);
add_action('transition_post_status', [$this, 'transitionPostStatus'], 10, 3);
}
Expand Down Expand Up @@ -176,48 +174,6 @@ public function deletedPost(int $post_id): void
flush_rewrite_rules();
}

/**
* Register Customizer settings.
*
* @param WP_Customize_Manager $wp_customize
*
* @return void
*/
public function customizerRegister(WP_Customize_Manager $wp_customize): void {
$cpts = $this->getPostTypes();
if (empty($cpts)) {
return;
}

$wp_customize
->add_section(ITINERIS_PAPTA_SLUG . '-archive', [
'title' => __('Pages for post type archives', 'page-as-post-type-archive'),
]);

foreach ($cpts as $cpt) {
if (! $cpt->has_archive || 'post' === $cpt->name) {
continue;
}

$id = "page_for_{$cpt->name}";

$wp_customize
->add_setting($id, [
'type' => 'option',
'capability' => 'manage_options',
'default' => 0,
'sanitize_callback' => [$this, 'saveSettingsCallback'],
]);

$wp_customize
->add_control($id, [
'type' => 'dropdown-pages',
'section' => ITINERIS_PAPTA_SLUG . '-archive',
'label' => $cpt->labels->name,
]);
}
}

public function registerPostTypeArgs(array $args, string $post_type): array
{
$post_type_page = (int) get_option("page_for_{$post_type}", 0);
Expand Down

0 comments on commit 2711152

Please sign in to comment.