This commit is contained in:
nguyen dung
2022-02-18 16:43:41 +07:00
commit 39b8cb3612
4470 changed files with 1378320 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
<?php
Flatsome_Option::add_section( 'blog-archive', array(
'title' => __( 'Blog Archive', 'flatsome-admin' ),
'panel' => 'blog',
'description' => __( 'Set custom layouts for archive pages like Categories, Search etc.', 'flatsome-admin' ),
) );
Flatsome_Option::add_field( 'option', array(
'type' => 'checkbox',
'settings' => 'blog_archive_title',
'label' => __( 'Enable Blog Archive Title', 'flatsome-admin' ),
'section' => 'blog-archive',
'default' => 1,
));
Flatsome_Option::add_field( 'option', array(
'type' => 'radio-image',
'settings' => 'blog_style_archive',
'label' => __( 'Posts Layout', 'flatsome-admin' ),
'section' => 'blog-archive',
'default' => '',
'choices' => array(
'' => $image_url . 'blog-default.svg',
'normal' => $image_url . 'blog-normal.svg',
'inline' => $image_url . 'blog-inline.svg',
'2-col' => $image_url . 'blog-two-col.svg',
'3-col' =>$image_url . 'blog-three-col.svg',
'list' => $image_url . 'blog-list.svg',
),
));

View File

@@ -0,0 +1,57 @@
<?php
Flatsome_Option::add_section( 'blog-featured', array(
'title' => __( 'Blog Featured Posts', 'flatsome-admin' ),
'panel' => 'blog',
) );
Flatsome_Option::add_field( 'option', array(
'type' => 'radio-image',
'settings' => 'blog_featured',
'label' => __( 'Featured Posts', 'flatsome-admin' ),
'description' => __( 'Show Featured posts in a slider above content. You need to make a post "Sticky" to show it here.', 'flatsome-admin' ),
'section' => 'blog-featured',
'default' => '',
'choices' => array(
'' => $image_url . 'disabled.svg',
'content' => $image_url . 'featured-posts.svg',
'top' =>$image_url . 'featured-posts-top.svg',
),
));
Flatsome_Option::add_field( 'option', array(
'type' => 'checkbox',
'settings' => 'blog_hide_sticky',
'label' => __( 'Hide Featured Posts from Default Blog feed.', 'flatsome-admin' ),
'section' => 'blog-featured',
'default' => 0,
));
Flatsome_Option::add_field( 'option', array(
'type' => 'slider',
'settings' => 'blog_featured_height',
'label' => __( 'Featured Posts Height', 'flatsome-admin' ),
//'help' => __( 'This is some extra help. You can use this to add some additional instructions for users. The main description should go in the "description" of the field, this is only to be used for help tips.', 'flatsome-admin' ),
'section' => 'blog-featured',
'default' => 500,
'choices' => array(
'min' => 200,
'max' => 1000,
'step' => 1
),
'transport' => $transport,
));
Flatsome_Option::add_field( 'option', array(
'type' => 'radio-buttonset',
'settings' => 'blog_featured_image_size',
'label' => esc_attr__( 'Image Size', 'flatsome-admin' ),
'section' => 'blog-featured',
'default' => 'medium',
'choices' => array(
'thumbnail' => 'Thumbnail',
'medium' => 'Medium',
'large' => 'Large',
'original' => 'Original',
),
) );

View File

@@ -0,0 +1,44 @@
<?php
Flatsome_Option::add_section( 'blog-global', array(
'title' => __( 'Blog Global', 'flatsome-admin' ),
'panel' => 'blog',
) );
Flatsome_Option::add_field( 'option', array(
'type' => 'checkbox',
'settings' => 'blog_badge',
'label' => __( 'Show Date Box', 'flatsome-admin' ),
'section' => 'blog-global',
'default' => 1,
) );
Flatsome_Option::add_field( 'option', array(
'type' => 'radio-image',
'settings' => 'blog_badge_style',
'label' => __( 'Date Box Style', 'flatsome-admin' ),
'section' => 'blog-global',
'default' => 'outline',
'active_callback' => array(
array(
'setting' => 'blog_badge',
'operator' => '==',
'value' => '1',
),
),
'choices' => array(
'square' => $image_url . 'badge-square.svg',
'circle' => $image_url . 'badge-circle.svg',
'circle-inside' => $image_url . 'badge-circle-inside.svg',
'outline' => $image_url . 'badge-outline.svg',
),
) );
Flatsome_Option::add_field( 'option', array(
'type' => 'text',
'settings' => 'blog_excerpt_suffix',
'label' => __( 'Blog Excerpt Suffix', 'flatsome-admin' ),
'description' => __( 'Choose custom post excerpt suffix. Default [...]', 'flatsome-admin' ),
'section' => 'blog-global',
'default' => ' [...]',
) );

View File

@@ -0,0 +1,188 @@
<?php
Flatsome_Option::add_section( 'blog-layout', array(
'title' => __( 'Blog Layout', 'flatsome-admin' ),
'panel' => 'blog',
) );
Flatsome_Option::add_field( 'option', array(
'type' => 'textarea',
'settings' => 'blog_header',
//'transport' => $transport,
'label' => __( 'Blog Homepage Header', 'flatsome-admin' ),
'description' => __( 'Enter HTML for blog header here. Will be placed above content and sidebar. Shortcodes are allowed. F.ex [block id="blog-header"]', 'flatsome-admin' ),
'section' => 'blog-layout',
'sanitize_callback' => 'flatsome_custom_sanitize',
));
Flatsome_Option::add_field( 'option', array(
'type' => 'checkbox',
'settings' => 'blog_archive_transparent',
'label' => __( 'Transparent Header', 'flatsome-admin' ),
'section' => 'blog-layout',
'default' => 0,
));
Flatsome_Option::add_field( 'option', array(
'type' => 'radio-image',
'settings' => 'blog_layout',
'label' => __( 'Blog Sidebar', 'flatsome-admin' ),
'section' => 'blog-layout',
'default' => 'right-sidebar',
'transport' => $transport,
'choices' => array(
'right-sidebar' => $image_url . 'layout-right.svg',
'left-sidebar' => $image_url . 'layout-left.svg',
'no-sidebar' => $image_url . 'layout-no-sidebar.svg',
),
));
Flatsome_Option::add_field( 'option', array(
'type' => 'checkbox',
'settings' => 'blog_layout_divider',
'label' => __( 'Enable Sidebar Divider', 'flatsome-admin' ),
'section' => 'blog-layout',
'transport' => $transport,
'default' => 1,
));
Flatsome_Option::add_field( 'option', array(
'type' => 'checkbox',
'settings' => 'blog_sticky_sidebar',
'label' => __( 'Sticky sidebar', 'flatsome-admin' ),
'section' => 'blog-layout',
'default' => 0,
) );
Flatsome_Option::add_field( 'option', array(
'type' => 'radio-image',
'settings' => 'blog_style',
'label' => __( 'Posts Layout', 'flatsome-admin' ),
'section' => 'blog-layout',
'default' => 'normal',
'choices' => array(
'normal' => $image_url . 'blog-normal.svg',
'inline' => $image_url . 'blog-inline.svg',
'2-col' => $image_url . 'blog-two-col.svg',
'3-col' =>$image_url . 'blog-three-col.svg',
'list' => $image_url . 'blog-list.svg',
),
));
Flatsome_Option::add_field( 'option', array(
'type' => 'radio-buttonset',
'settings' => 'blog_style_type',
'label' => __( 'Posts Layout Type', 'flatsome-admin' ),
'section' => 'blog-layout',
'default' => 'masonry',
'choices' => array(
'row' => __( 'Row', 'flatsome-admin' ),
'masonry' => __( 'Masonry', 'flatsome-admin' ),
),
'active_callback' => array(
array(
'setting' => 'blog_style',
'operator' => 'contains',
'value' => array( '2-col', '3-col' ),
),
),
));
Flatsome_Option::add_field( 'option', array(
'type' => 'checkbox',
'settings' => 'blog_show_excerpt',
'transport' => $transport,
'label' => __( 'Show Excerpts Only', 'flatsome-admin' ),
'help' => __( 'Show Excerpts only of the Blog posts. You can manually add a Read More link by adding a More Tag to the Post Content.', 'flatsome-admin' ),
'section' => 'blog-layout',
'default' => 1,
));
Flatsome_Option::add_field( 'option', array(
'type' => 'color-alpha',
'settings' => 'blog_bg_color',
'label' => __( 'Blog Background Color', 'flatsome-admin' ),
'section' => 'blog-layout',
'default' => '',
'transport' => 'postMessage',
'js_vars' => array(
array(
'element' => '.blog-wrapper',
'function' => 'css',
'property' => 'background-color'
),
)
));
Flatsome_Option::add_field( 'option', array(
'type' => 'slider',
'settings' => 'blog_posts_depth',
'label' => __( 'Depth', 'flatsome-admin' ),
'section' => 'blog-layout',
'default' => 0,
'choices' => array(
'min' => 0,
'max' => 5,
'step' => 1
),
'transport' => $transport
));
Flatsome_Option::add_field( 'option', array(
'type' => 'slider',
'settings' => 'blog_posts_depth_hover',
'label' => __( 'Depth :hover', 'flatsome-admin' ),
'section' => 'blog-layout',
'default' => 0,
'choices' => array(
'min' => 0,
'max' => 5,
'step' => 1
),
'transport' => $transport
));
Flatsome_Option::add_field( '', array(
'type' => 'custom',
'settings' => 'custom_title_post_layout',
'label' => __( '', 'flatsome-admin' ),
'section' => 'blog-layout',
'default' => '<div class="options-title-divider">Post layout</div>',
) );
Flatsome_Option::add_field( 'option', array(
'type' => 'radio-image',
'settings' => 'blog_posts_header_style',
'label' => __( 'Posts Title Style', 'flatsome-admin' ),
'section' => 'blog-layout',
'active_callback' => array(
array(
'setting' => 'blog_style',
'operator' => '===',
'value' => 'normal',
),
),
'default' => 'normal',
'choices' => array(
'normal' => $image_url . 'text-top.svg',
'bottom' => $image_url . 'text-bottom.svg',
),
));
Flatsome_Option::add_field( 'option', array(
'type' => 'radio-image',
'settings' => 'blog_posts_title_align',
'label' => __( 'Posts Title Align', 'flatsome-admin' ),
'section' => 'blog-layout',
'default' => 'center',
'choices' => array(
'left' => $image_url . 'align-left.svg',
'center' => $image_url . 'align-center.svg',
'right' => $image_url . 'align-right.svg',
),
));

View File

@@ -0,0 +1,98 @@
<?php
Flatsome_Option::add_section( 'blog-single', array(
'title' => __( 'Blog Single Post', 'flatsome-admin' ),
'panel' => 'blog',
) );
Flatsome_Option::add_field( 'option', array(
'type' => 'radio-image',
'settings' => 'blog_post_layout',
'label' => __( 'Blog Post Single Layout', 'flatsome-admin' ),
'section' => 'blog-single',
'default' => 'right-sidebar',
'choices' => array(
'right-sidebar' => $image_url . 'layout-right.svg',
'left-sidebar' => $image_url . 'layout-left.svg',
'no-sidebar' => $image_url . 'layout-no-sidebar.svg',
),
) );
Flatsome_Option::add_field( 'option', array(
'type' => 'radio-image',
'settings' => 'blog_post_style',
'label' => __( 'Title Layout', 'flatsome-admin' ),
'section' => 'blog-single',
'default' => 'default',
'choices' => array(
'default' => $image_url . 'blog-single.svg',
'top' => $image_url . 'blog-single-full.svg',
'inline' => $image_url . 'blog-single-inline.svg',
),
) );
Flatsome_Option::add_field( 'option', array(
'type' => 'checkbox',
'settings' => 'blog_single_transparent',
'label' => __( 'Transparent Header', 'flatsome-admin' ),
'section' => 'blog-single',
'default' => 0,
) );
Flatsome_Option::add_field( 'option', array(
'type' => 'checkbox',
'settings' => 'blog_single_header_meta',
'label' => __( 'Enable Header Meta', 'flatsome-admin' ),
'section' => 'blog-single',
'default' => 1,
) );
Flatsome_Option::add_field( 'option', array(
'type' => 'checkbox',
'settings' => 'blog_single_featured_image',
'label' => __( 'Enable Featured Image', 'flatsome-admin' ),
'section' => 'blog-single',
'default' => 1,
) );
Flatsome_Option::add_field( 'option', array(
'type' => 'checkbox',
'settings' => 'blog_share',
'label' => __( 'Enable Share Icons', 'flatsome-admin' ),
'section' => 'blog-single',
'default' => 1,
) );
Flatsome_Option::add_field( 'option', array(
'type' => 'checkbox',
'settings' => 'blog_single_footer_meta',
'label' => __( 'Enable Footer Meta', 'flatsome-admin' ),
'section' => 'blog-single',
'default' => 1,
) );
Flatsome_Option::add_field( 'option', array(
'type' => 'checkbox',
'settings' => 'blog_author_box',
'label' => __( 'Enable Blog Author Box', 'flatsome-admin' ),
'section' => 'blog-single',
'default' => 1,
) );
Flatsome_Option::add_field( 'option', array(
'type' => 'checkbox',
'settings' => 'blog_single_next_prev_nav',
'label' => __( 'Enable Next/Prev Navigation', 'flatsome-admin' ),
'section' => 'blog-single',
'default' => 1,
) );
Flatsome_Option::add_field( 'option', array(
'type' => 'textarea',
'settings' => 'blog_after_post',
'label' => __( 'HTML after blog posts', 'flatsome-admin' ),
'section' => 'blog-single',
'description' => 'Enter HTML or shortcodes that will be visible after blog posts. (Before comment box). Shortcodes are allowed',
'sanitize_callback' => 'flatsome_custom_sanitize',
'default' => '',
) );

View File

@@ -0,0 +1,47 @@
<?php
Flatsome_Option::add_panel( 'blog', array(
'title' => __( 'Blog', 'flatsome-admin' ),
) );
include_once( dirname( __FILE__ ) . '/options-blog-global.php' );
include_once(dirname( __FILE__ ).'/options-blog-layout.php');
include_once(dirname( __FILE__ ).'/options-blog-archive.php');
include_once(dirname( __FILE__ ).'/options-blog-single.php');
include_once(dirname( __FILE__ ).'/options-blog-featured.php');
function flatsome_refresh_blog_partials( WP_Customize_Manager $wp_customize ) {
// Abort if selective refresh is not available.
if ( ! isset( $wp_customize->selective_refresh ) ) {
return;
}
$wp_customize->selective_refresh->add_partial( 'blog-layout', array(
'selector' => '.blog-wrapper.blog-archive',
'settings' => array('blog_posts_depth_hover','blog_posts_depth','blog_layout','blog_layout_divider','blog_show_excerpt'),
'render_callback' => function() {
get_template_part( 'template-parts/posts/layout', get_theme_mod('blog_layout','right-sidebar') );
},
) );
$wp_customize->selective_refresh->add_partial( 'blog-layout-single', array(
'selector' => '.blog-wrapper.blog-single',
'settings' => array('blog_posts_depth_hover','blog_posts_depth','blog_post_layout','blog_post_style','blog_single_header_meta','blog_single_footer_meta','blog_single_featured_image','blog_share','blog_author_box','blog_single_next_prev_nav'),
'render_callback' => function() {
get_template_part( 'template-parts/posts/layout', get_theme_mod('blog_post_layout','right-sidebar') );
},
) );
$wp_customize->selective_refresh->add_partial( 'blog-featured-posts', array(
'selector' => '.featured-posts',
'container_inclusive' => true,
'settings' => array('blog_featured_height'),
'render_callback' => function() {
get_template_part('template-parts/posts/featured-posts');
},
) );
}
add_action( 'customize_register', 'flatsome_refresh_blog_partials' );