This commit is contained in:
Alexander Agnarson 2019-01-19 16:32:33 +01:00
parent 8cf4a571d8
commit 7b96d6c852
7 changed files with 162 additions and 113 deletions

View file

@ -3,7 +3,7 @@
Plugin Name: Alx Extensions
Plugin URI: http://wordpress.org/plugins/alx-extensions/
Description: Extends AlxMedia themes with additional features such as social share links, custom sidebars, thumbnail image upscale and post format meta boxes. Also includes 2 flexible custom widgets, Alx Tabs and Alx Posts.
Version: 1.0.5
Version: 1.0.6
Author: Alexander Agnarson
Author URI: http://alxmedia.se
Text Domain: alx

View file

@ -6,23 +6,51 @@ function alx_ext_custom_options() {
if ( ! class_exists( 'Kirki' ) ) {
return;
}
// Config: Alx Extensions
Kirki::add_config( 'alx_extensions', array(
'capability' => 'edit_theme_options',
'option_type' => 'theme_mod',
) );
// Panel: Theme Extensions
Kirki::add_panel( 'alx_extensions_panel', array(
'priority' => 11,
'title' => esc_html__( 'Theme Extensions', 'alx' ),
) );
// Section: Social Share
Kirki::add_section( 'alx_extensions_social', array(
'priority' => 10,
'title' => esc_html__( 'Social Share', 'alx' ),
'panel' => 'alx_extensions_panel',
) );
// Section: Image Upscale
Kirki::add_section( 'alx_extensions_upscale', array(
'priority' => 11,
'title' => esc_html__( 'Image Upscale', 'alx' ),
'panel' => 'alx_extensions_panel',
) );
// Section: Custom Sidebars
Kirki::add_section( 'alx_extensions_custom_sidebars', array(
'priority' => 12,
'title' => esc_html__( 'Custom Sidebars', 'alx' ),
'panel' => 'alx_extensions_panel',
) );
// Section: Custom Widgets
Kirki::add_section( 'alx_extensions_widgets', array(
'priority' => 13,
'title' => esc_html__( 'Custom Widgets', 'alx' ),
'panel' => 'alx_extensions_panel',
) );
// Section: Meta Boxes
Kirki::add_section( 'alx_extensions_meta_boxes', array(
'priority' => 14,
'title' => esc_html__( 'Meta Boxes', 'alx' ),
'panel' => 'alx_extensions_panel',
) );
// Social Share: Enable
Kirki::add_field( 'enable_social_share', array(
'type' => 'switch',
'settings' => 'enable-social-share',
@ -30,7 +58,7 @@ function alx_ext_custom_options() {
'section' => 'alx_extensions_social',
'default' => 'on',
) );
// Social Share: Twitter Username
Kirki::add_field( 'twitter_username', array(
'type' => 'text',
'settings' => 'twitter-username',
@ -38,29 +66,17 @@ function alx_ext_custom_options() {
'description' => esc_html__( 'Your @username will be added to share-tweets of your posts (optional)', 'alx' ),
'section' => 'alx_extensions_social',
'default' => '',
) );
Kirki::add_section( 'alx_extensions_upscale', array(
'priority' => 10,
'title' => esc_html__( 'Image Upscale', 'alx' ),
'panel' => 'alx_extensions_panel',
) );
) );
// Image Upscale: Enable
Kirki::add_field( 'enable_image_upscale', array(
'type' => 'switch',
'settings' => 'enable-image-upscale',
'label' => esc_html__( 'Enable Image Upscale', 'alx' ),
'description' => esc_html__( 'Scales up small images and crops to the right thumbnail sizes (recommended)', 'alx' ),
'section' => 'alx_extensions_upscale',
'default' => 'on',
) );
Kirki::add_section( 'alx_extensions_custom_sidebars', array(
'priority' => 10,
'title' => esc_html__( 'Custom Sidebars', 'alx' ),
'panel' => 'alx_extensions_panel',
) );
// Sidebars: Create Sidebars
// Custom Sidebars: Create Sidebars
Kirki::add_field( 'alx_sidebar', array(
'type' => 'repeater',
'label' => esc_html__( 'Create Sidebars', 'alx' ),
@ -88,13 +104,7 @@ function alx_ext_custom_options() {
),
)
) );
Kirki::add_section( 'alx_extensions_widgets', array(
'priority' => 11,
'title' => esc_html__( 'Custom Widgets', 'alx' ),
'panel' => 'alx_extensions_panel',
) );
// Custom Widgets: Alx Posts
Kirki::add_field( 'alx_posts', array(
'type' => 'switch',
'settings' => 'widget-alx-posts',
@ -102,7 +112,7 @@ function alx_ext_custom_options() {
'section' => 'alx_extensions_widgets',
'default' => 'on',
) );
// Custom Widgets: Alx Tabs
Kirki::add_field( 'alx_tabs', array(
'type' => 'switch',
'settings' => 'widget-alx-tabs',
@ -110,4 +120,20 @@ function alx_ext_custom_options() {
'section' => 'alx_extensions_widgets',
'default' => 'on',
) );
// Meta Boxes: Post Format Audio
Kirki::add_field( 'alx_meta_box_audio', array(
'type' => 'switch',
'settings' => 'alx-meta-box-audio',
'label' => esc_html__( 'Post Format: Audio', 'alx' ),
'section' => 'alx_extensions_meta_boxes',
'default' => 'on',
) );
// Meta Boxes: Post Format Video
Kirki::add_field( 'alx_meta_box_video', array(
'type' => 'switch',
'settings' => 'alx-meta-box-video',
'label' => esc_html__( 'Post Format: Video', 'alx' ),
'section' => 'alx_extensions_meta_boxes',
'default' => 'on',
) );
}

View file

@ -4,42 +4,50 @@ function alx_ext_post_formats_meta_box( $meta_boxes ) {
/* do not show */
$prefix = '_';
/* Format: audio
/* ------------------------------------ */
$meta_boxes[] = array(
'id' => 'format-audio',
'title' => esc_html__( 'Format: Audio', 'alx' ),
'post_types' => array( 'post' ),
'context' => 'advanced',
'priority' => 'high',
'autosave' => false,
'fields' => array(
array(
'id' => $prefix . 'audio_url',
'type' => 'text',
'name' => esc_html__( 'Audio URL', 'alx' ),
if ( get_theme_mod( 'alx-meta-box-audio', 'on' ) == 'on') {
/* Format: audio
/* ------------------------------------ */
$meta_boxes[] = array(
'id' => 'format-audio',
'title' => esc_html__( 'Format: Audio', 'alx' ),
'post_types' => array( 'post' ),
'context' => 'advanced',
'priority' => 'high',
'autosave' => false,
'fields' => array(
array(
'id' => $prefix . 'audio_url',
'type' => 'text',
'name' => esc_html__( 'Audio URL', 'alx' ),
),
),
),
);
/* Format: video
/* ------------------------------------ */
$meta_boxes[] = array(
'id' => 'format-video',
'title' => esc_html__( 'Format: Video', 'alx' ),
'post_types' => array( 'post' ),
'context' => 'advanced',
'priority' => 'high',
'autosave' => false,
'fields' => array(
array(
'id' => $prefix . 'video_url',
'type' => 'text',
'name' => esc_html__( 'Video URL', 'alx' ),
);
}
if ( get_theme_mod( 'alx-meta-box-video', 'on' ) == 'on') {
/* Format: video
/* ------------------------------------ */
$meta_boxes[] = array(
'id' => 'format-video',
'title' => esc_html__( 'Format: Video', 'alx' ),
'post_types' => array( 'post' ),
'context' => 'advanced',
'priority' => 'high',
'autosave' => false,
'fields' => array(
array(
'id' => $prefix . 'video_url',
'type' => 'text',
'name' => esc_html__( 'Video URL', 'alx' ),
),
),
),
);
);
}
return $meta_boxes;
}

View file

@ -16,7 +16,7 @@ class AlxPosts extends WP_Widget {
/* Constructor
/* ------------------------------------ */
function __construct() {
parent::__construct( false, esc_html__( 'Alx Posts (plugin)', 'alx' ), array('description' => esc_html__( 'Display posts from a category', 'alx' ), 'classname' => 'widget_alx_posts', 'customize_selective_refresh' => true ) );
parent::__construct( false, esc_html__( 'Alx Posts', 'alx' ), array('description' => esc_html__( 'Display posts from a category', 'alx' ), 'classname' => 'widget_alx_posts', 'customize_selective_refresh' => true ) );
}
public function alx_get_defaults() {

View file

@ -16,7 +16,7 @@ class AlxTabs extends WP_Widget {
/* Constructor
/* ------------------------------------ */
function __construct() {
parent::__construct( false, esc_html__( 'Alx Tabs (plugin)', 'alx' ), array('description' => esc_html__('List posts, comments, and/or tags with or without tabs.', 'alx' ), 'classname' => 'widget_alx_tabs', 'customize_selective_refresh' => true ) );
parent::__construct( false, esc_html__( 'Alx Tabs', 'alx' ), array('description' => esc_html__('List posts, comments, and/or tags with or without tabs.', 'alx' ), 'classname' => 'widget_alx_tabs', 'customize_selective_refresh' => true ) );
}
public function alx_get_defaults() {

View file

@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: Alx Extensions\n"
"POT-Creation-Date: 2019-01-16 13:57+0100\n"
"POT-Creation-Date: 2019-01-19 16:28+0100\n"
"PO-Revision-Date: 2018-09-21 21:27+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -17,97 +17,114 @@ msgstr ""
"X-Poedit-Basepath: ..\n"
"X-Poedit-SearchPath-0: .\n"
#: inc/options.php:17
#: inc/options.php:19
msgid "Theme Extensions"
msgstr ""
#: inc/options.php:22
#: inc/options.php:25
msgid "Social Share"
msgstr ""
#: inc/options.php:29
msgid "Enable Social Share"
msgstr ""
#: inc/options.php:37
msgid "Twitter Username"
msgstr ""
#: inc/options.php:38
msgid "Your @username will be added to share-tweets of your posts (optional)"
msgstr ""
#: inc/options.php:45
#: inc/options.php:31
msgid "Image Upscale"
msgstr ""
#: inc/options.php:52
msgid "Enable Image Upscale"
msgstr ""
#: inc/options.php:59
#: inc/options.php:37
msgid "Custom Sidebars"
msgstr ""
#: inc/options.php:43
msgid "Custom Widgets"
msgstr ""
#: inc/options.php:49
msgid "Meta Boxes"
msgstr ""
#: inc/options.php:57
msgid "Enable Social Share"
msgstr ""
#: inc/options.php:65
msgid "Twitter Username"
msgstr ""
#: inc/options.php:66
msgid "Your @username will be added to share-tweets of your posts (optional)"
msgstr ""
#: inc/options.php:74
msgid "Enable Image Upscale"
msgstr ""
#: inc/options.php:75
msgid ""
"Scales up small images and crops to the right thumbnail sizes (recommended)"
msgstr ""
#: inc/options.php:82
msgid "Create Sidebars"
msgstr ""
#: inc/options.php:67
#: inc/options.php:83
msgid "You must save and refresh the page to see your new sidebars."
msgstr ""
#: inc/options.php:68
#: inc/options.php:84
msgid ""
"Make sure that you save and refresh the page if you can not see the sidebars "
"you have created."
msgstr ""
#: inc/options.php:72
#: inc/options.php:88
msgid "sidebar"
msgstr ""
#: inc/options.php:79
#: inc/options.php:95
msgid "Sidebar Title"
msgstr ""
#: inc/options.php:80
#: inc/options.php:96
msgid "The widget box title"
msgstr ""
#: inc/options.php:85
#: inc/options.php:101
msgid "Sidebar ID"
msgstr ""
#: inc/options.php:86
#: inc/options.php:102
msgid "This ID must be unique"
msgstr ""
#: inc/options.php:94
msgid "Custom Widgets"
msgstr ""
#: inc/options.php:101
#: inc/options.php:111 inc/widgets/alx-posts.php:19
msgid "Alx Posts"
msgstr ""
#: inc/options.php:109
#: inc/options.php:119 inc/widgets/alx-tabs.php:19
msgid "Alx Tabs"
msgstr ""
#: inc/post-formats.php:12
#: inc/options.php:127
msgid "Post Format: Audio"
msgstr ""
#: inc/options.php:135
msgid "Post Format: Video"
msgstr ""
#: inc/post-formats.php:14
msgid "Format: Audio"
msgstr ""
#: inc/post-formats.php:21
#: inc/post-formats.php:23
msgid "Audio URL"
msgstr ""
#: inc/post-formats.php:30
#: inc/post-formats.php:36
msgid "Format: Video"
msgstr ""
#: inc/post-formats.php:39
#: inc/post-formats.php:45
msgid "Video URL"
msgstr ""
@ -140,10 +157,6 @@ msgstr ""
msgid "Share on LinkedIn"
msgstr ""
#: inc/widgets/alx-posts.php:19
msgid "Alx Posts (plugin)"
msgstr ""
#: inc/widgets/alx-posts.php:19
msgid "Display posts from a category"
msgstr ""
@ -228,10 +241,6 @@ msgstr ""
msgid "Show dates"
msgstr ""
#: inc/widgets/alx-tabs.php:19
msgid "Alx Tabs (plugin)"
msgstr ""
#: inc/widgets/alx-tabs.php:19
msgid "List posts, comments, and/or tags with or without tabs."
msgstr ""

View file

@ -4,7 +4,7 @@ Contributors: alxmedia
Tags:
Requires at least: 5.0
Tested up to: 5.0
Stable tag: 1.0.5
Stable tag: 1.0.6
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
@ -16,6 +16,12 @@ Extends AlxMedia themes with additional features such as social share links, cus
== Changelog ==
= 1.0.6 - 2019-01-19 =
* Update .pot language file
* Add options to disable meta boxes
* Re-order and clear up options code
* Remove "(plugin)" from custom widget titles
= 1.0.5 - 2019-01-14 =
* Update .pot language file
* Add alx_ext_sharrre_footer action and template