| Server IP : 184.75.252.78 / Your IP : 216.73.217.174 Web Server : LiteSpeed System : Linux dia.sitehostingserver.com 3.10.0-962.3.2.lve1.5.88.el7.x86_64 #1 SMP Fri Sep 26 14:06:42 UTC 2025 x86_64 User : kikeda ( 1072) PHP Version : 8.2.31 Disable Function : popen,imap_mail,exec,passthru,system,shell_exec,proc_open,pcntl_exec,eval,allow_url_fopen,allow_url_include,mail,proc_get_status,get_cfg_var,disk_free_space,disk_total_space,diskfreespace,getmygid,getmyinode,getmypid,geymyuid,proc_nice,proc_terminate,proc_close,apache_child_terminate,chown,lchgrp,lchown,link,readlink,exif_read_data,read_exif_data,exif_thumbnail,highlight_file,show_source,php_strip_whitespace,get_meta_tags,dl,leak,pfsockopen,event_new,pcntl_signal,pcntl_alarm,register_tick_function,apache_setenv,define_syslog_variables,escapeshellarg,escapeshellcmd,ini_alter,ini_restore,inject_code,openlog,syslog,xmlrpc_entity_decode,phpAds_remoteInfo,phpAds_XmlRpc,phpAds_xmlrpcDecode,phpAds_xmlrpcEncode,chgrp,php_eval,safe_dir,root,ftok,egy_perl,symlink,wscript MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/kikeda/public_html/ballerleather.com/wp-content/themes/magzimum/inc/ |
Upload File : |
<?php
if ( ! function_exists( 'magzimum_add_theme_meta_box' ) ) :
/**
* Add the Meta Box
*
* @since Magzimum 1.0
*/
function magzimum_add_theme_meta_box() {
$apply_metabox_post_types = array( 'post', 'page' );
foreach ( $apply_metabox_post_types as $key => $type ) {
add_meta_box(
'theme-settings',
esc_html__( 'Theme Settings', 'magzimum' ),
'magzimum_render_theme_settings_metabox',
$type
);
}
}
endif;
add_action( 'add_meta_boxes', 'magzimum_add_theme_meta_box' );
if ( ! function_exists( 'magzimum_render_theme_settings_metabox' ) ) :
/**
* Render theme settings meta box
*
* @since Magzimum 1.0
*/
function magzimum_render_theme_settings_metabox() {
global $post;
$post_id = $post->ID;
// Meta box nonce for verification
wp_nonce_field( basename( __FILE__ ), 'magzimum_theme_settings_meta_box_nonce' );
// Fetch Options list
$global_layout_options = magzimum_get_global_layout_options();
$image_size_options = magzimum_get_image_sizes_options();
$image_alignment_options = magzimum_get_single_image_alignment_options();
// Fetch values of current post meta
$values = get_post_meta( $post_id, 'theme_settings', true );
$theme_settings_post_layout = isset( $values['post_layout'] ) ? esc_attr( $values['post_layout'] ) : '';
$theme_settings_single_image = isset( $values['single_image'] ) ? esc_attr( $values['single_image'] ) : '';
?>
<!-- Layout option -->
<p><strong><?php esc_html_e( 'Choose Layout', 'magzimum' ); ?></strong></p>
<select name="theme_settings[post_layout]" id="theme_settings_post_layout">
<option value=""><?php esc_html_e( 'Default', 'magzimum' ); ?></option>
<?php if ( ! empty( $global_layout_options ) ): ?>
<?php foreach ( $global_layout_options as $key => $val ): ?>
<option value="<?php echo esc_attr( $key ); ?>" <?php selected( $theme_settings_post_layout, $key ); ?> ><?php echo esc_html( $val ); ?></option>
<?php endforeach ?>
<?php endif ?>
</select>
<!-- Image in single post/page -->
<p><strong><?php esc_html_e( 'Choose Image Size in Single Post/Page', 'magzimum' ); ?></strong></p>
<select name="theme_settings[single_image]" id="theme_settings_single_image">
<option value=""><?php esc_html_e( 'Default', 'magzimum' ); ?></option>
<?php if ( ! empty( $image_size_options ) ): ?>
<?php foreach ( $image_size_options as $key => $val ): ?>
<option value="<?php echo esc_attr( $key ); ?>" <?php selected( $theme_settings_single_image, $key ); ?> ><?php echo esc_html( $val ); ?></option>
<?php endforeach ?>
<?php endif ?>
</select>
<?php
}
endif;
if ( ! function_exists( 'magzimum_save_theme_settings_meta' ) ) :
/**
* Save theme settings meta box value
*
* @since Magzimum 1.0
*/
function magzimum_save_theme_settings_meta( $post_id ) {
// Verify nonce
if ( ! isset( $_POST['magzimum_theme_settings_meta_box_nonce'] ) || ! wp_verify_nonce( sanitize_key( $_POST['magzimum_theme_settings_meta_box_nonce'] ), basename( __FILE__ ) ) )
return;
// Bail if auto save
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
return;
// Check permission
if ( 'page' == $_POST['post_type'] ) {
if ( ! current_user_can( 'edit_page', $post_id ) )
return;
} else if ( ! current_user_can( 'edit_post', $post_id ) ) {
return;
}
if( ! array_filter( $_POST['theme_settings'] ) ) {
// no values
delete_post_meta( $post_id, 'theme_settings' );
}
else{
update_post_meta( $post_id, 'theme_settings', $_POST['theme_settings'] );
}
}
endif;
add_action( 'save_post', 'magzimum_save_theme_settings_meta' );