File: /disk001/machen/www/support/wp-content/themes/wp-moose/inc/customizer/sections/archive.php
<?php
if ( !function_exists( 'wp_moose_register_posts_options' ) ) {
/**
* Add posts options and controls.
*
* @param \WP_Customize_Manager $wp_customize
* @param string $section_id
* @param int $priority
*/
function wp_moose_register_posts_options( $wp_customize, $section_id, $priority = 100 )
{
$wp_customize->add_section( $section_id, array(
'title' => esc_html__( 'Archive Settings', 'wp-moose' ),
'panel' => '',
'priority' => $priority,
) );
if ( wp_moose_fs()->is_not_paying() ) {
wp_moose_register_options( $wp_customize, array(
'name' => 'wp_moose_posts_structure_upsell_tips',
'section' => $section_id,
'settings' => array(),
'custom_control' => Moose_Info_Customize_Control::class,
'control_args' => array(
'messages' => array(
esc_html__( 'In our Pro version, you can get:', 'wp-moose' ),
array(
esc_html__( 'Grid layout', 'wp-moose' ),
esc_html__( 'Adjust post item structure', 'wp-moose' ),
esc_html__( 'Adjust metas content and order', 'wp-moose' ),
esc_html__( 'Show hero in archive page', 'wp-moose' ),
esc_html__( 'Different header style in archive page', 'wp-moose' ),
esc_html__( 'Additional button styles', 'wp-moose' ),
esc_html__( 'Additional pagination styles', 'wp-moose' )
),
sprintf( '<a href="%1$s" target="_blank">%2$s</a>', wp_moose_upsell_url(), __( 'Meet Moose Pro', 'wp-moose' ) ),
array( sprintf( '<a href="%1$s" target="_blank">%2$s</a>', 'https://www.wpmoose.com/docs/moose-theme-docs/theme-customization/customize-archive/', __( 'Customize Archive Video Tutorial', 'wp-moose' ) ), sprintf( '<a href="%1$s" target="_blank">%2$s</a>', 'https://www.wpmoose.com/docs/moose-theme-docs/theme-customization/show-hero-in-archive/', __( 'Archive Hero Video Tutorial', 'wp-moose' ) ) )
),
),
) );
}
wp_moose_register_options( $wp_customize, array(
'name' => 'wp_moose_posts_layout_and_content',
'section' => $section_id,
'settings' => array(),
'custom_control' => Moose_Heading_Customize_Control::class,
'control_args' => array(
'title' => esc_html__( 'LAYOUT & CONTENT', 'wp-moose' ),
),
) );
wp_moose_register_options( $wp_customize, array(
'name' => 'wp_moose_posts_layout',
'label' => esc_html__( 'Posts Layout', 'wp-moose' ),
'choices' => wp_moose_get_archive_layout_options(),
'section' => $section_id,
'custom_control' => Moose_Image_Radio_Button_Customize_Control::class,
'control_args' => array(
'should_init' => true,
'subcontrols' => array(
'archive-grid' => array( 'wp_moose_grid_layout_columns', 'wp_moose_grid_layout_upsell_tips' ),
'archive-left' => array( 'wp_moose_archive_list_layout_image_width' ),
'archive-right' => array( 'wp_moose_archive_list_layout_image_width' ),
),
),
) );
wp_moose_register_options( $wp_customize, array(
'name' => 'wp_moose_archive_list_layout_image_width',
'label' => esc_html__( 'Feature Image Width', 'wp-moose' ),
'description' => esc_html__( '"0" means use the default value', 'wp-moose' ),
'section' => $section_id,
'custom_control' => Moose_Slider_Customize_Control::class,
'choices' => array(
'desktop' => array(
'min' => 0,
'max' => 75,
'step' => 1,
'unit' => '%',
),
),
'settings' => array(
'desktop' => 'wp_moose_archive_list_layout_image_width',
),
) );
if ( wp_moose_fs()->is_not_paying() ) {
wp_moose_register_options( $wp_customize, array(
'name' => 'wp_moose_grid_layout_upsell_tips',
'section' => $section_id,
'settings' => array(),
'custom_control' => Moose_Info_Customize_Control::class,
'control_args' => array(
'messages' => array( esc_html__( 'In our Pro version, you can set different grid columns count for pc, tablet and mobile.', 'wp-moose' ), sprintf( '<a href="%1$s" target="_blank">%2$s</a>', wp_moose_upsell_url(), __( 'Meet Moose Pro', 'wp-moose' ) ) ),
),
) );
}
wp_moose_register_options( $wp_customize, array(
'name' => 'wp_moose_layout_divider',
'section' => $section_id,
'settings' => array(),
'custom_control' => Moose_Divider_Customize_Control::class,
) );
wp_moose_register_options( $wp_customize, array(
'name' => 'wp_moose_show_archive_feature_image',
'label' => esc_html__( 'Show Feature Image', 'wp-moose' ),
'section' => $section_id,
'custom_control' => Moose_Switch_Customize_Control::class,
) );
wp_moose_register_options( $wp_customize, array(
'name' => 'wp_moose_excerpt_length',
'label' => esc_html__( 'Excerpt length (words)', 'wp-moose' ),
'type' => 'number',
'section' => $section_id,
'input_attrs' => array(
'min' => 10,
'max' => 200,
'step' => 5,
),
) );
wp_moose_register_options( $wp_customize, array(
'name' => 'wp_moose_read_more_text',
'label' => esc_html__( 'Read More Text', 'wp-moose' ),
'type' => 'text',
'section' => $section_id,
) );
wp_moose_register_options( $wp_customize, array(
'name' => 'wp_moose_posts_style',
'section' => $section_id,
'settings' => array(),
'custom_control' => Moose_Heading_Customize_Control::class,
'control_args' => array(
'title' => esc_html__( 'STYLE', 'wp-moose' ),
),
) );
wp_moose_register_options( $wp_customize, array(
'name' => 'wp_moose_button_style',
'label' => esc_html__( 'Button Style', 'wp-moose' ),
'type' => 'select',
'section' => $section_id,
'choices' => wp_moose_get_button_style_options(),
) );
wp_moose_register_options( $wp_customize, array(
'name' => 'wp_moose_pagination_style',
'label' => esc_html__( 'Pagination Style', 'wp-moose' ),
'type' => 'select',
'section' => $section_id,
'choices' => wp_moose_get_button_style_options(),
) );
wp_moose_register_options( $wp_customize, array(
'name' => 'wp_moose_pagination_type',
'label' => esc_html__( 'Pagination Type', 'wp-moose' ),
'type' => 'select',
'section' => $section_id,
'choices' => wp_moose_get_pagination_options(),
) );
wp_moose_register_options( $wp_customize, array(
'name' => 'wp_moose_is_outline_pagination',
'label' => esc_html__( 'Pagination Outline', 'wp-moose' ),
'section' => $section_id,
'custom_control' => Moose_Switch_Customize_Control::class,
) );
}
}
if ( !function_exists( 'get_wp_moose_grid_layout_columns' ) ) {
/**
* Get grid layout columns count
*
* @param $device
*
* @return mixed|void
*/
function get_wp_moose_grid_layout_columns( $device )
{
return get_wp_moose_option( 'wp_moose_grid_layout_columns_' . $device );
}
}
if ( !function_exists( 'get_wp_moose_grid_layout_columns_style' ) ) {
/**
* Get grid layout columns css class names
*
* @return string
*/
function get_wp_moose_grid_layout_columns_style()
{
if ( function_exists( 'get_wp_moose_grid_layout_columns_style__premium_only' ) ) {
return get_wp_moose_grid_layout_columns_style__premium_only();
}
return '';
}
}
if ( !function_exists( 'get_wp_moose_button_style' ) ) {
/**
* Return css class for button
*
* @return string
*/
function get_wp_moose_button_style()
{
return wp_moose_get_button_style_css( get_wp_moose_option( 'wp_moose_button_style' ) );
}
}
if ( !function_exists( 'wp_moose_button_style' ) ) {
/**
* Output css class for button
*/
function wp_moose_button_style()
{
echo get_wp_moose_button_style() ;
}
}
if ( !function_exists( 'get_wp_moose_pagination_style' ) ) {
/**
* Return css class for pagination
*
* @return string
*/
function get_wp_moose_pagination_style()
{
$style = get_wp_moose_option( 'wp_moose_pagination_style' );
$is_outline = get_wp_moose_option( 'wp_moose_is_outline_pagination' );
$css = wp_moose_get_button_style_css( $style );
if ( $is_outline ) {
$css .= ' btn-outline';
}
return $css;
}
}
if ( !function_exists( 'wp_moose_pagination_style' ) ) {
/**
* Output css class for pagination
*/
function wp_moose_pagination_style()
{
echo get_wp_moose_pagination_style() ;
}
}