feat: add page lightgallery (#600)

pull/620/head^2
Seaton Jiang 2024-01-17 01:41:31 +08:00
parent 14f6ca2038
commit b17962e99e
No known key found for this signature in database
GPG Key ID: 1E85ACC90F7EB73E
5 changed files with 18 additions and 12 deletions

View File

@ -157,7 +157,7 @@
};
var lightGalleryConfig = function () {
if (kratos.lightgallery === "1" && window.lightGallery !== undefined) {
if (typeof lightGallery !== 'undefined') {
lightGallery(document.getElementById("lightgallery"), {
selector:
'a[href$=".jpg"], a[href$=".jpeg"], a[href$=".png"], a[href$=".gif"], a[href$=".bmp"], a[href$=".webp"]',

View File

@ -4,7 +4,7 @@
* 核心函数
* @author Seaton Jiang <hi@seatonjiang.com>
* @license GPL-3.0 License
* @version 2023.04.04
* @version 2024.01.17
*/
use YahnisElsts\PluginUpdateChecker\v5\PucFactory;
@ -43,7 +43,7 @@ function theme_autoload()
wp_enqueue_style('bootstrap', ASSET_PATH . '/assets/css/bootstrap.min.css', array(), '4.5.0');
wp_enqueue_style('kicon', ASSET_PATH . '/assets/css/iconfont.min.css', array(), THEME_VERSION);
wp_enqueue_style('layer', ASSET_PATH . '/assets/css/layer.min.css', array(), '3.1.1');
if (kratos_option('g_lightgallery', true)) {
if ((kratos_option('g_article_lightgallery', true) && is_single()) || (kratos_option('g_page_lightgallery', true) && is_page())) {
wp_enqueue_script('lightgallery', ASSET_PATH . '/assets/js/lightgallery.min.js', array(), '1.4.0', true);
wp_enqueue_style('lightgallery', ASSET_PATH . '/assets/css/lightgallery.min.css', array(), '1.4.0');
}
@ -106,7 +106,6 @@ function theme_autoload()
'directory' => ASSET_PATH,
'alipay' => kratos_option('g_donate_fieldset')['g_donate_alipay'] ?? '',
'wechat' => kratos_option('g_donate_fieldset')['g_donate_wechat'] ?? '',
'lightgallery' => kratos_option('g_lightgallery', true),
'repeat' => __('您已经赞过了', 'kratos'),
'thanks' => __('感谢您的支持', 'kratos'),
'donate' => __('打赏作者', 'kratos'),

View File

@ -4,7 +4,7 @@
* 主题选项
* @author Seaton Jiang <hi@seatonjiang.com>
* @license GPL-3.0 License
* @version 2023.08.25
* @version 2024.01.17
*/
defined('ABSPATH') || exit;
@ -148,6 +148,13 @@ CSF::createSection($prefix, array(
'subtitle' => __('启用/禁用 Gutenberg 编辑器', 'kratos'),
'default' => false,
),
array(
'id' => 'g_page_lightgallery',
'type' => 'switcher',
'title' => __('页面图片灯箱', 'kratos'),
'subtitle' => __('启用/禁用页面图片灯箱功能', 'kratos'),
'default' => true,
),
array(
'id' => 'g_excerpt_length',
'type' => 'text',
@ -682,7 +689,7 @@ CSF::createSection($prefix, array(
'default' => true,
),
array(
'id' => 'g_lightgallery',
'id' => 'g_article_lightgallery',
'type' => 'switcher',
'title' => __('文章图片灯箱', 'kratos'),
'subtitle' => __('启用/禁用文章图片灯箱功能', 'kratos'),

View File

@ -4,7 +4,7 @@
* Template Name: 单页样式
* @author Seaton Jiang <hi@seatonjiang.com>
* @license GPL-3.0 License
* @version 2022.11.27
* @version 2024.01.17
*/
get_header(); ?>
@ -18,7 +18,7 @@ get_header(); ?>
<div class="header text-center">
<h1 class="title m-0"><?php the_title(); ?></h1>
</div>
<div class="content">
<div class="content" id="lightgallery">
<?php
the_content();
wp_link_pages(

View File

@ -4,7 +4,7 @@
* 页面模板
* @author Seaton Jiang <hi@seatonjiang.com>
* @license GPL-3.0 License
* @version 2022.01.26
* @version 2024.01.17
*/
get_header(); ?>
@ -18,7 +18,7 @@ get_header(); ?>
<div class="header text-center">
<h1 class="title m-0"><?php the_title(); ?></h1>
</div>
<div class="content">
<div class="content" id="lightgallery">
<?php
the_content();
wp_link_pages(