-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added 'Select a Page' option in page mapping setting
- Loading branch information
Showing
9 changed files
with
465 additions
and
317 deletions.
There are no files selected for viewing
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
/** | ||
* BuddyX\Buddyx\Dropdown_Select\Component class | ||
* | ||
* @package buddyx | ||
*/ | ||
|
||
namespace BuddyX\Buddyx\Dropdown_Select; | ||
|
||
use BuddyX\Buddyx\Component_Interface; | ||
use Kirki\Field\Select; | ||
|
||
/** | ||
* Class to override kirki drop down pages field | ||
*/ | ||
class Component extends Select implements Component_Interface { | ||
|
||
/** | ||
* Gets the unique identifier for the theme component. | ||
* | ||
* @return string Component slug. | ||
*/ | ||
public function get_slug() : string { | ||
return 'dropdown_select'; | ||
} | ||
|
||
/** | ||
* Adds the action and filter hooks to integrate with WordPress. | ||
*/ | ||
public function initialize() {} | ||
|
||
/** | ||
* Filter arguments before creating the control. | ||
* | ||
* @access public | ||
* @since 0.1 | ||
* @param array $args The field arguments. | ||
* @param WP_Customize_Manager $wp_customize The customizer instance. | ||
* @return array | ||
*/ | ||
public function filter_control_args( $args, $wp_customize ) { | ||
|
||
if ( 'buddyx_login_page' === $args['settings'] || 'buddyx_registration_page' === $args['settings'] || 'buddyx_404_page' === $args['settings'] ) { | ||
|
||
$args = parent::filter_control_args( $args, $wp_customize ); | ||
|
||
$all_pages = get_pages(); | ||
$args['choices'][0] = __( '-- Select a Page --', 'buddyx' ); | ||
|
||
foreach ( $all_pages as $page ) { | ||
$args['choices'][ $page->ID ] = $page->post_title; | ||
} | ||
} | ||
|
||
return $args; | ||
} | ||
|
||
} |
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
Oops, something went wrong.