mirror of
https://ghproxy.net/https://github.com/AlxMedia/alx-extensions.git
synced 2025-08-26 15:53:37 +08:00
commit
f955b80080
4 changed files with 95 additions and 42 deletions
|
@ -17,9 +17,9 @@ define( 'ALX_EXTENSIONS_BASENAME', basename( dirname( __FILE__ ) ) );
|
|||
define( 'ALX_EXTENSIONS_DIR', rtrim( plugin_dir_path( __FILE__ ), '/' ) );
|
||||
define( 'ALX_EXTENSIONS_URL', rtrim( plugin_dir_url( __FILE__ ), '/' ) );
|
||||
|
||||
require_once ALX_EXTENSIONS_DIR . '/inc/options.php';
|
||||
require_once ALX_EXTENSIONS_DIR . '/inc/share.php';
|
||||
require_once ALX_EXTENSIONS_DIR . '/inc/post-formats.php';
|
||||
require_once ALX_EXTENSIONS_DIR . '/inc/sidebar.php';
|
||||
|
||||
/* load plugin textdomain */
|
||||
function alx_ext_load_textdomain() {
|
||||
|
@ -62,4 +62,8 @@ function alx_ext_thumbnail_upscale( $default, $orig_w, $orig_h, $new_w, $new_h,
|
|||
return array( 0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h );
|
||||
}
|
||||
|
||||
add_filter( 'image_resize_dimensions', 'alx_ext_thumbnail_upscale', 10, 6 );
|
||||
$enable_image_upscale = get_theme_mod( 'enable_image_upscale', true );
|
||||
if ( true === $enable_image_upscale ) {
|
||||
add_filter( 'image_resize_dimensions', 'alx_ext_thumbnail_upscale', 10, 6 );
|
||||
}
|
||||
|
||||
|
|
82
inc/options.php
Normal file
82
inc/options.php
Normal file
|
@ -0,0 +1,82 @@
|
|||
<?php
|
||||
|
||||
add_action( 'after_setup_theme', 'alx_ext_custom_options', 11 );
|
||||
|
||||
function alx_ext_custom_options() {
|
||||
if ( ! class_exists( 'Kirki' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
Kirki::add_config( 'alx_extensions', array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'option_type' => 'theme_mod',
|
||||
) );
|
||||
|
||||
Kirki::add_panel( 'alx_extensions_panel', array(
|
||||
'priority' => 11,
|
||||
'title' => esc_html__( 'Theme Extensions', 'alx-extensions' ),
|
||||
) );
|
||||
|
||||
Kirki::add_section( 'alx_extensions_social', array(
|
||||
'priority' => 10,
|
||||
'title' => esc_html__( 'Social Share', 'alx-extensions' ),
|
||||
'panel' => 'alx_extensions_panel',
|
||||
) );
|
||||
|
||||
Kirki::add_field( 'enable_social_share', array(
|
||||
'type' => 'switch',
|
||||
'settings' => 'enable_social_share',
|
||||
'label' => esc_html__( 'Enable Social Share', 'alx-extensions' ),
|
||||
'section' => 'alx_extensions_social',
|
||||
'default' => 'on',
|
||||
) );
|
||||
|
||||
Kirki::add_section( 'alx_extensions_upscale', array(
|
||||
'priority' => 10,
|
||||
'title' => esc_html__( 'Image Upscale', 'alx-extensions' ),
|
||||
'panel' => 'alx_extensions_panel',
|
||||
) );
|
||||
|
||||
Kirki::add_field( 'enable_image_upscale', array(
|
||||
'type' => 'switch',
|
||||
'settings' => 'enable_image_upscale',
|
||||
'label' => esc_html__( 'Enable Image Upscale', 'alx-extensions' ),
|
||||
'section' => 'alx_extensions_upscale',
|
||||
'default' => 'on',
|
||||
) );
|
||||
|
||||
Kirki::add_section( 'alx_extensions_custom_sidebars', array(
|
||||
'priority' => 10,
|
||||
'title' => esc_html__( 'Custom Sidebars', 'alx-extensions' ),
|
||||
'panel' => 'alx_extensions_panel',
|
||||
) );
|
||||
|
||||
// Sidebars: Create Sidebars
|
||||
Kirki::add_field( 'alx_sidebar', array(
|
||||
'type' => 'repeater',
|
||||
'label' => esc_html__( 'Create Sidebars', 'alx-extensions' ),
|
||||
'description' => esc_html__( 'You must save and refresh the page to see your new sidebars.', 'alx-extensions' ),
|
||||
'tooltip' => esc_html__( 'Make sure that you save and refresh the page if you can not see the sidebars you have created.', 'alx-extensions' ),
|
||||
'section' => 'alx_extensions_custom_sidebars',
|
||||
'row_label' => array(
|
||||
'type' => 'text',
|
||||
'value' => esc_html__('sidebar', 'alx-extensions' ),
|
||||
),
|
||||
'settings' => 'sidebar-areas',
|
||||
'default' => '',
|
||||
'fields' => array(
|
||||
'title' => array(
|
||||
'type' => 'text',
|
||||
'label' => esc_html__( 'Sidebar Title', 'alx-extensions' ),
|
||||
'description' => esc_html__( 'The widget box title', 'alx-extensions' ),
|
||||
'default' => '',
|
||||
),
|
||||
'id' => array(
|
||||
'type' => 'text',
|
||||
'label' => esc_html__( 'Sidebar ID', 'alx-extensions' ),
|
||||
'description' => esc_html__( 'This ID must be unique', 'alx-extensions' ),
|
||||
'default' => 'sidebar-',
|
||||
),
|
||||
)
|
||||
) );
|
||||
}
|
|
@ -6,7 +6,13 @@ function alx_ext_sharrre_actions() {
|
|||
add_action( 'plugins_loaded', 'alx_ext_sharrre_actions' );
|
||||
|
||||
/* template */
|
||||
function alx_ext_sharrre_template() { ?>
|
||||
function alx_ext_sharrre_template() {
|
||||
|
||||
$enable_social_share = get_theme_mod( 'enable_social_share', true );
|
||||
if ( true !== $enable_social_share ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="sharrre-container group">
|
||||
<span><?php esc_html_e('Share','alx-extensions'); ?></span>
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
|
||||
add_action( 'after_setup_theme', 'alx_ext_custom_sidebars', 11 );
|
||||
|
||||
function alx_ext_custom_sidebars() {
|
||||
if ( ! class_exists( 'Kirki' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Sidebars: Create Sidebars
|
||||
Kirki::add_field( 'alx_theme', array(
|
||||
'type' => 'repeater',
|
||||
'label' => esc_html__( 'Create Sidebars', 'alx-extensions' ),
|
||||
'description' => esc_html__( 'You must save and refresh the page to see your new sidebars.', 'alx-extensions' ),
|
||||
'tooltip' => esc_html__( 'Make sure that you save and refresh the page if you can not see the sidebars you have created.', 'alx-extensions' ),
|
||||
'section' => 'sidebars',
|
||||
'row_label' => array(
|
||||
'type' => 'text',
|
||||
'value' => esc_html__('sidebar', 'alx-extensions' ),
|
||||
),
|
||||
'settings' => 'sidebar-areas',
|
||||
'default' => '',
|
||||
'fields' => array(
|
||||
'title' => array(
|
||||
'type' => 'text',
|
||||
'label' => esc_html__( 'Sidebar Title', 'alx-extensions' ),
|
||||
'description' => esc_html__( 'The widget box title', 'alx-extensions' ),
|
||||
'default' => '',
|
||||
),
|
||||
'id' => array(
|
||||
'type' => 'text',
|
||||
'label' => esc_html__( 'Sidebar ID', 'alx-extensions' ),
|
||||
'description' => esc_html__( 'This ID must be unique', 'alx-extensions' ),
|
||||
'default' => 'sidebar-',
|
||||
),
|
||||
)
|
||||
) );
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue