';
echo esc_html__( 'All settings of the front part of the theme are located in the visual editor', 'airin-blog' );
echo ' » ' . esc_html__( 'Open', 'airin-blog' ) . '';
echo '
',
'',
'general-tab'
);
// Setting the size of the main image of posts and pages (width)
add_settings_field(
'airinblog_set_size_imgs_all',
esc_html__( 'Choose which images to use for the entire site', 'airin-blog' ),
'airinblog_fun_callback_size_img_all',
'general-tab',
'airinblog_set_section_img_all'
);
register_setting( 'general-tab', 'airinblog_set_size_imgs_all' );
// ------------------------------------------------------------
// Main post image
// ------------------------------------------------------------
// Section
add_settings_section(
'airinblog_set_section_thumb_post',
'
' . esc_html__( 'Main post image', 'airin-blog' ) . '
',
'',
'general-tab'
);
// Setting the size of the main image of posts and pages (width)
add_settings_field(
'airinblog_set_size_img_post_w',
esc_html__( 'Add a new image size and apply the default for the main image of posts and pages', 'airin-blog' ),
'airinblog_fun_callback_size_img_post_w_front',
'general-tab',
'airinblog_set_section_thumb_post',
array(
'label_for' => 'airinblog_set_size_img_post_w',
'class' => 'airinblog-class',
'name' => 'airinblog_set_size_img_post_w',
)
);
register_setting( 'general-tab', 'airinblog_set_size_img_post_w', 'absint' );
// Setting the size of the main image of posts and pages (height)
add_settings_field(
'airinblog_set_size_img_post_h',
esc_html__( 'To restore the default settings, clear the field data and save', 'airin-blog' ),
'airinblog_fun_callback_size_img_post_h_front',
'general-tab',
'airinblog_set_section_thumb_post',
array(
'label_for' => 'airinblog_set_size_img_post_h',
'class' => 'airinblog-class',
'name' => 'airinblog_set_size_img_post_h',
)
);
register_setting( 'general-tab', 'airinblog_set_size_img_post_h', 'absint' );
}
add_action( 'admin_init', 'airinblog_fun_theme_settings' );
// ------------------------------------------------------------
// CALLBACK - Support links
// ------------------------------------------------------------
// Support
if ( !defined( 'DMCWZAF_VERSION' ) ) {
function airinblog_fun_callback_support_contact() {
echo '
' . esc_html__( 'The theme creates multiple thumbnail sizes in a single 16x9 format and uses optimal sizes in the right places. This has a good effect on loading speed and proper display in a unified style.', 'airin-blog' ) . '
' . esc_html__( 'You can change this setting to control the size of the images yourself.', 'airin-blog' ) . '
' . sprintf( esc_html__( 'It is important to know! These settings cannot delete or modify existing image files. Slicing of images occurs at the time of uploading a new image to the %s media library.', 'airin-blog' ), 'WordPress' ) . '
' . esc_html__( 'To change old pictures, use the thumbnail regeneration plugin.', 'airin-blog' ) . '
';
}
// ------------------------------------------------------------
// CALLBACK - Main image for post
// ------------------------------------------------------------
// Adjusting the size of the main post image
function airinblog_fun_callback_size_img_post_w_front( $args ) {
$value = get_option( $args['name'] );
printf(
'
' . esc_html__( 'These settings register a new size for the main (top) image of posts and pages.', 'airin-blog' ) . '
' . esc_html__( 'After applying, all new uploaded images will be supplemented with the new size, which is apply by default for the main image of posts and pages.', 'airin-blog' ) . '
' . sprintf( esc_html__( 'It is important to know! These settings cannot delete or modify existing image files. Slicing of images occurs at the time of uploading a new image to the %s media library.', 'airin-blog' ), 'WordPress' ) . '
' . esc_html__( 'To change old pictures, use the thumbnail regeneration plugin.', 'airin-blog' ) . '
',
esc_attr( $args['name'] ),
esc_attr( $args['name'] ),
absint( $value )
);
}
//----------------------------------------------------------------------------------
//region Important notices
//----------------------------------------------------------------------------------
// Create nonce
function airinblog_fun_generate_one_key() {
$nonce = get_option( 'airinblog_set_generate_nonce' );
if ( !$nonce ) {
$nonce = bin2hex( random_bytes( 8 ) );
update_option( 'airinblog_set_generate_nonce', $nonce );
}
return $nonce;
}
// Display scripts only on page (and tabs) dmcwzmulti_page_settings
// Per WordPress rules - use $hook_suffix
// info - developer.wordpress.org/reference/hooks/admin_footer-hook_suffix/
// The page is defined as - appearance_page_dmcwzmulti_page_settings
function airinblog_fun_admin_set_page_script_plans( $hook_suffix ) {
$tab_page = array('appearance_page_dmcwzmulti_page_settings', 'appearance_page_dmcwzmulti_page_settings-pricing');
if ( !in_array( $hook_suffix, $tab_page ) ) {
return;
}
if ( $hook_suffix === 'appearance_page_dmcwzmulti_page_settings-pricing' ) {
// Scripts for plans (Important notices)
wp_enqueue_script(
'airinblog-script-admin-set-plans',
get_template_directory_uri() . '/js/admin/usability.js',
array('jquery'),
AIRINBLOG_VERSION,
true
);
wp_localize_script( 'airinblog-script-admin-set-plans', 'AIRINBLOG_PUB_KEY_PLAN', array(
'pluginKey' => 'airinblog-public-key',
'oneKey' => airinblog_fun_generate_one_key(),
) );
} else {
// Scripts for settings (Important notices)
wp_enqueue_script(
'airinblog-script-admin-set-settings',
get_template_directory_uri() . '/js/admin/usability-settings.js',
array('jquery'),
AIRINBLOG_VERSION,
true
);
wp_localize_script( 'airinblog-script-admin-set-settings', 'AIRINBLOG_PUB_KEY_SET', array(
'pluginKey' => 'airinblog-public-key',
'oneKey' => airinblog_fun_generate_one_key(),
) );
}
}
add_action( 'admin_enqueue_scripts', 'airinblog_fun_admin_set_page_script_plans' );