Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show websitename in page metadata to enhance SEO (search engine optim… #718

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion assets/js/custom-jquery-date-time-picker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable no-undef */

jQuery( function ( $ ) {
$.datetimepicker.setLocale( 'de' );

Expand Down
46 changes: 39 additions & 7 deletions functions/options/class-sunflowersettingspage.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ public function sunflower_add_plugin_page(): void {
public function create_sunflower_settings_page(): void {
// Set class properties from options.
$this->options = get_option( 'sunflower_options' );

if ( ! is_array( $this->options ) ) {
$this->options = array();
}

// Set default values.
$this->options['sunflower_schema_org'] = $this->options['sunflower_schema_org'] ?? 'checked';
$this->options['sunflower_categories_archive'] = $this->options['sunflower_categories_archive'] ?? 'main-categories';

?>
<div class="wrap">
<h1><?php esc_html_e( 'Sunflower Settings', 'sunflower' ); ?></h1>
Expand Down Expand Up @@ -115,7 +124,10 @@ public function sunflower_settings_page_init(): void {
$this->sunflower_checkbox_callback( ... ),
'sunflower-setting-admin',
'sunflower_layout',
array( 'sunflower_show_related_posts', __( 'show related posts', 'sunflower' ) )
array(
'field' => 'sunflower_show_related_posts',
'label' => __( 'show related posts', 'sunflower' ),
)
);

add_settings_field(
Expand All @@ -124,7 +136,10 @@ public function sunflower_settings_page_init(): void {
$this->sunflower_checkbox_callback( ... ),
'sunflower-setting-admin',
'sunflower_layout',
array( 'sunflower_show_author', __( 'Show post author on post details and via REST api.', 'sunflower' ) )
array(
'field' => 'sunflower_show_author',
'label' => __( 'Show post author on post details and via REST api.', 'sunflower' ),
)
);

add_settings_field(
Expand All @@ -133,7 +148,10 @@ public function sunflower_settings_page_init(): void {
$this->sunflower_checkbox_callback( ... ),
'sunflower-setting-admin',
'sunflower_layout',
array( 'sunflower_hide_prev_next', __( 'hide previous and next links', 'sunflower' ) )
array(
'field' => 'sunflower_hide_prev_next',
'label' => __( 'hide previous and next links', 'sunflower' ),
)
);

add_settings_field(
Expand All @@ -151,7 +169,10 @@ public function sunflower_settings_page_init(): void {
$this->sunflower_checkbox_callback( ... ),
'sunflower-setting-admin',
'sunflower_layout',
array( 'sunflower_main_menu_item_is_placeholder', __( 'items with href=# in the main menu are placeholders for submenu', 'sunflower' ) )
array(
'field' => 'sunflower_main_menu_item_is_placeholder',
'label' => __( 'items with href=# in the main menu are placeholders for submenu', 'sunflower' ),
)
);

add_settings_field(
Expand All @@ -177,8 +198,19 @@ public function sunflower_settings_page_init(): void {
__( 'Show list of categories on category archive', 'sunflower' ),
$this->sunflower_categories_archive( ... ),
'sunflower-setting-admin',
'sunflower_layout'
);

add_settings_field(
'sunflower_schema_org',
__( 'Enhance SEO', 'sunflower' ),
$this->sunflower_checkbox_callback( ... ),
'sunflower-setting-admin',
'sunflower_layout',
array( 'sunflower_categories_filter', __( 'Show list of categories on category archive', 'sunflower' ) )
array(
'field' => 'sunflower_schema_org',
'label' => __( 'Set website name in page metadata', 'sunflower' ),
)
);
}

Expand Down Expand Up @@ -217,8 +249,8 @@ public function print_section_info() {
* @param array $args The field arguments.
*/
public function sunflower_checkbox_callback( $args ): void {
$field = $args[0];
$label = $args[1];
$field = $args['field'];
$label = $args['label'];

printf(
'<label>
Expand Down
Binary file modified languages/de_DE.mo
Binary file not shown.
Loading