),
array(
'field' => 'template',
'operator' => '!=',
'value' => 'custom',
),
array(
'field' => 'show_post_reading_time',
'operator' => '==',
'value' => '1',
),
),
),
array(
'type' => 'jnews-select',
'id' => 'post_calculate_word_method',
'label' => esc_html__( 'Word Count Calculation Method', 'jnews' ),
'description' => esc_html__( 'Select the Word Count Calculation Method.', 'jnews' ),
'default' => get_theme_mod( 'jnews_calculate_word_method', 'str_word_count' ),
'choices' => array(
array(
'value' => 'str_word_count',
'label' => esc_attr__( 'PHP Word Counter Method', 'jnews' ),
),
array(
'value' => 'count_blank',
'label' => esc_attr__( 'Count the spaces between the words', 'jnews' ),
),
),
'dependency' => array(
array(
'field' => 'show_post_meta',
'operator' => '==',
'value' => '1',
),
array(
'field' => 'template',
'operator' => '!=',
'value' => 'custom',
),
array(
'field' => 'show_post_reading_time',
'operator' => '==',
'value' => '1',
),
),
),
array(
'type' => 'jnews-toggle',
'id' => 'show_zoom_button',
'label' => esc_html__( 'Show Zoom Button', 'jnews' ),
'description' => esc_html__( 'Show zoom button on the post meta container.', 'jnews' ),
'default' => (string) get_theme_mod( 'jnews_single_zoom_button', '0' ),
'dependency' => array(
array(
'field' => 'show_post_meta',
'operator' => '==',
'value' => '1',
),
array(
'field' => 'template',
'operator' => '!=',
'value' => 'custom',
),
),
),
array(
'type' => 'jnews-slider',
'id' => 'zoom_button_out_step',
'label' => esc_html__( 'Number of Zoom Out Step', 'jnews' ),
'description' => esc_html__( 'Set the number of zoom out step to limit when zoom out button clicked.', 'jnews' ),
'min' => '1',
'max' => '5',
'step' => '1',
'choices' => array(
'min' => '1',
'max' => '5',
'step' => '1',
),
'default' => get_theme_mod( 'jnews_single_zoom_button_out_step', '2' ),
'dependency' => array(
array(
'field' => 'show_post_meta',
'operator' => '==',
'value' => '1',
),
array(
'field' => 'show_zoom_button',
'operator' => '==',
'value' => '1',
),
array(
'field' => 'template',
'operator' => '!=',
'value' => 'custom',
),
),
),
array(
'type' => 'jnews-slider',
'id' => 'zoom_button_in_step',
'label' => esc_html__( 'Number of Zoom In Step', 'jnews' ),
'description' => esc_html__( 'Set the number of zoom in step to limit when zoom in button clicked.', 'jnews' ),
'min' => '1',
'max' => '5',
'step' => '1',
'choices' => array(
'min' => '1',
'max' => '5',
'step' => '1',
),
'default' => get_theme_mod( 'jnews_single_zoom_button_in_step', '3' ),
'dependency' => array(
array(
'field' => 'show_post_meta',
'operator' => '==',
'value' => '1',
),
array(
'field' => 'show_zoom_button',
'operator' => '==',
'value' => '1',
),
array(
'field' => 'template',
'operator' => '!=',
'value' => 'custom',
),
),
),
array(
'type' => 'jnews-toggle',
'id' => 'show_post_tag',
'label' => esc_html__( 'Show Post Tag', 'jnews' ),
'description' => esc_html__( 'Show single post tag (below article).', 'jnews' ),
'default' => (string) get_theme_mod( 'jnews_single_show_tag', '1' ),
'dependency' => array(
array(
'field' => 'template',
'operator' => '!=',
'value' => 'custom',
),
),
),
array(
'type' => 'jnews-toggle',
'id' => 'show_prev_next_post',
'label' => esc_html__( 'Show Prev / Next Post', 'jnews' ),
'description' => esc_html__( 'Show previous or next post navigation (below article).', 'jnews' ),
'default' => (string) get_theme_mod( 'jnews_single_show_prev_next_post', '1' ),
'dependency' => array(
array(
'field' => 'template',
'operator' => '!=',
'value' => 'custom',
),
),
),
array(
'type' => 'jnews-toggle',
'id' => 'show_popup_post',
'label' => esc_html__( 'Show Popup Post', 'jnews' ),
'description' => esc_html__( 'Show bottom right popup post widget.', 'jnews' ),
'default' => (string) get_theme_mod( 'jnews_single_show_popup_post', '1' ),
),
array(
'type' => 'jnews-slider',
'id' => 'number_popup_post',
'label' => esc_html__( 'Number of Post', 'jnews' ),
'description' => esc_html__( 'Set the number of post to show when popup post appear.', 'jnews' ),
'min' => '1',
'max' => '5',
'step' => '1',
'choices' => array(
'min' => '1',
'max' => '5',
'step' => '1',
),
'default' => get_theme_mod( 'jnews_single_number_popup_post', '1' ),
'dependency' => array(
array(
'field' => 'show_popup_post',
'operator' => '==',
'value' => '1',
),
),
),
array(
'type' => 'jnews-toggle',
'id' => 'show_author_box',
'label' => esc_html__( 'Show Author Box', 'jnews' ),
'description' => esc_html__( 'Show author box (below article).', 'jnews' ),
'default' => (string) get_theme_mod( 'jnews_single_show_author_box', '0' ),
'dependency' => array(
array(
'field' => 'template',
'operator' => '!=',
'value' => 'custom',
),
),
),
array(
'type' => 'jnews-toggle',
'id' => 'show_post_related',
'label' => esc_html__( 'Show Post Related', 'jnews' ),
'description' => esc_html__( 'Show post related (below article).', 'jnews' ),
'default' => (string) get_theme_mod( 'jnews_single_show_post_related', '0' ),
'dependency' => array(
array(
'field' => 'template',
'operator' => '!=',
'value' => 'custom',
),
),
),
array(
'type' => 'jnews-toggle',
'id' => 'show_inline_post_related',
'label' => esc_html__( 'Show Inline Post Related', 'jnews' ),
'description' => esc_html__( 'Show inline post related (inside article).', 'jnews' ),
'default' => (string) get_theme_mod( 'jnews_single_post_show_inline_related', '0' ),
'dependency' => array(
array(
'field' => 'template',
'operator' => '!=',
'value' => 'custom',
),
),
),
),
),
),
),
array(
'type' => 'tab',
'id' => 'override_image_size_tab',
'label' => esc_html__( 'Override Image Size', 'jnews' ),
'fields' => array(
array(
'type' => 'jnews-toggle',
'id' => 'override_image_size',
'label' => esc_html__( 'Override Image Thumbnail Size', 'jnews' ),
'description' => esc_html__( 'Check this option and you will have option to override your image thumbnail size. If you are using post template with full size image, this option will be ignored.', 'jnews' ),
),
array(
'type' => 'jnews-group',
'id' => 'image_override',
'label' => esc_html__( 'Image Size Override Option', 'jnews' ),
'description' => esc_html__( 'Option for overriding jnews single image size.', 'jnews' ),
'dependency' => array(
array(
'field' => 'override_image_size',
'operator' => '==',
'value' => '1',
),
),
'fields' => array(
array(
'type' => 'jnews-select',
'id' => 'single_post_thumbnail_size',
'label' => esc_html__( 'Post Thumbnail Size', 'jnews' ),
'description' => esc_html__( 'Choose image thumbnail size.', 'jnews' ),
'default' => get_theme_mod( 'jnews_single_post_thumbnail_size', 'crop-500' ),
'choices' => array(
array(
'value' => 'no-crop',
'label' => esc_html__( 'No Crop', 'jnews' ),
),
array(
'value' => 'crop-500',
'label' => esc_html__( 'Crop 1/2 Dimension', 'jnews' ),
),
array(
'value' => 'crop-715',
'label' => esc_html__( 'Crop Default Dimension', 'jnews' ),
),
),
),
array(
'type' => 'jnews-select',
'id' => 'single_post_gallery_size',
'label' => esc_html__( 'Post Gallery Thumbnail Size', 'jnews' ),
'description' => esc_html__( 'Choose image gallery thumbnail size.', 'jnews' ),
'default' => get_theme_mod( 'jnews_single_post_gallery_size', 'crop-500' ),
'choices' => array(
array(
'value' => 'crop-500',
'label' => esc_html__( 'Crop 1/2 Dimension', 'jnews' ),
),
array(
'value' => 'crop-715',
'label' => esc_html__( 'Crop Default Dimension', 'jnews' ),
),
),
),
),
),
),
),
array(
'type' => 'tab',
'id' => 'trending_post_tab',
'label' => esc_html__( 'Trending Post', 'jnews' ),
'fields' => array(
array(
'type' => 'jnews-toggle',
'id' => 'trending_post',
'label' => esc_html__( 'Trending Post', 'jnews' ),
'description' => esc_html__( 'Set this post as a trending post.', 'jnews' ),
),
array(
'type' => 'jnews-select',
'id' => 'trending_post_position',
'label' => esc_html__( 'Trending Post Position', 'jnews' ),
'description' => esc_html__( 'Choose trending post flag position.', 'jnews' ),
'default' => 'meta',
'choices' => array(
array(
'value' => 'meta',
'label' => esc_html__( 'Inline Post Meta', 'jnews' ),
),
array(
'value' => 'title',
'label' => esc_html__( 'Above Post Title', 'jnews' ),
),
),
'dependency' => array(
array(
'field' => 'trending_post',
'operator' => '==',
'value' => '1',
),
),
),
array(
'type' => 'jnews-text',
'id' => 'trending_post_label',
'label' => esc_html__( 'Trending Post Label', 'jnews' ),
'description' => esc_html__( 'Insert a text for trending post label.', 'jnews' ),
'default' => esc_html__( 'Trending', 'jnews' ),
'dependency' => array(
array(
'field' => 'trending_post',
'operator' => '==',
'value' => '1',
),
array(
'field' => 'trending_post_position',
'operator' => '==',
'value' => 'title',
),
),
),
),
),
array(
'type' => 'tab',
'id' => 'sponsored_post_tab',
'label' => esc_html__( 'Sponsored Post', 'jnews' ),
'fields' => array(
array(
'type' => 'jnews-toggle',
'id' => 'sponsored_post',
'label' => esc_html__( 'Sponsored Post', 'jnews' ),
'description' => esc_html__( 'Set this post as a sponsored post.', 'jnews' ),
),
array(
'type' => 'jnews-text',
'id' => 'sponsored_post_label',
'label' => esc_html__( 'Sponsored Post Label', 'jnews' ),
'description' => esc_html__( 'Insert a text for sponsored post label.', 'jnews' ),
'default' => esc_html__( 'Sponsored by', 'jnews' ),
'dependency' => array(
array(
'field' => 'sponsored_post',
'operator' => '==',
'value' => '1',
),
),
),
array(
'type' => 'jnews-text',
'id' => 'sponsored_post_name',
'label' => esc_html__( 'Sponsored Post Name', 'jnews' ),
'description' => esc_html__( 'Insert the name of sponsor.', 'jnews' ),
'dependency' => array(
array(
'field' => 'sponsored_post',
'operator' => '==',
'value' => '1',
),
),
),
array(
'type' => 'jnews-url',
'id' => 'sponsored_post_url',
'label' => esc_html__( 'Sponsored Post URL', 'jnews' ),
'description' => esc_html__( 'Insert url for the sponsor.', 'jnews' ),
'dependency' => array(
array(
'field' => 'sponsored_post',
'operator' => '==',
'value' => '1',
),
),
),
array(
'type' => 'jnews-toggle',
'id' => 'sponsored_post_logo_enable',
'label' => esc_html__( 'Show Sponsor Logo', 'jnews' ),
'description' => esc_html__( 'Enable this option to show the sponsor logo instead of sponsor name.', 'jnews' ),
'dependency' => array(
array(
'field' => 'sponsored_post',
'operator' => '==',
'value' => '1',
),
),
),
array(
'type' => 'jnews-image',
'id' => 'sponsored_post_logo',
'label' => esc_html__( 'Sponsored Post Logo', 'jnews' ),
'description' => esc_html__( 'Insert an image as sponsor logo.', 'jnews' ),
'dependency' => array(
array(
'field' => 'sponsored_post',
'operator' => '==',
'value' => '1',
),
array(
'field' => 'sponsored_post_logo_enable',
'operator' => '==',
'value' => '1',
),
),
),
array(
'type' => 'jnews-textarea',
'id' => 'sponsored_post_desc',
'label' => esc_html__( 'Sponsored Description', 'jnews' ),
'description' => esc_html__( 'Insert some text for sponsored post description.', 'jnews' ),
'dependency' => array(
array(
'field' => 'sponsored_post',
'operator' => '==',
'value' => '1',
),
),
),
),
),
array(
'type' => 'tab',
'id' => 'ad_post_tab',
'label' => esc_html__( 'Ad Option', 'jnews' ),
'fields' => array(
array(
'type' => 'jnews-toggle',
'id' => 'disable_ad',
'label' => esc_html__( 'Disable Ad', 'jnews' ),
'description' => esc_html__( "Don't Display ad on this post.", 'jnews' ),
'default' => '0',
),
),
),
),
);
$post_id = isset( $_REQUEST['post'] ) ? $_REQUEST['post'] : '';
$post_format = get_post_format( $post_id );
$general_setting = array(
'type' => 'tab',
'id' => 'general_setting',
'label' => esc_html__( 'General Settings', 'jnews' ),
'fields' => array(
array(
'type' => 'jnews-text',
'id' => 'subtitle',
'hideOnClassic' => true,
'default' => $post_id ? get_post_meta( $post_id, 'post_subtitle', true ) : '',
'label' => esc_html__( 'Post Subtitle', 'jnews' ),
'description' => esc_html__( 'Insert some text as post subtitle.', 'jnews' ),
),
array(
'type' => 'jnews-textarea',
'id' => 'video',
'default' => $post_id ? get_post_meta( $post_id, '_format_video_embed', true ) : '',
'label' => esc_html__( 'Video URL', 'jnews' ),
'allow_html' => true,
'description' => esc_html__( 'Insert video URL or embed code.', 'jnews' ),
'dependency' => array(
array(
'field' => 'format',
'operator' => '==',
'value' => 'video',
),
),
),
array(
'type' => 'jnews-multi-image',
'id' => 'gallery',
'label' => esc_html__( 'Gallery Format', 'jnews' ),
'description' => esc_html__( 'Insert some images as gallery.', 'jnews' ),
'dependency' => array(
array(
'field' => 'format',
'operator' => '==',
'value' => 'gallery',
),
),
),
array(
'type' => 'jnews-text',
'id' => 'source_name',
'label' => esc_html__( 'Source Name', 'jnews' ),
'description' => esc_html__( 'This source name will show at the end of the post content.', 'jnews' ),
),
array(
'type' => 'jnews-url',
'id' => 'source_url',
'label' => esc_html__( 'Source URL', 'jnews' ),
'description' => esc_html__( 'Insert source url link.', 'jnews' ),
),
array(
'type' => 'jnews-text',
'id' => 'via_name',
'label' => esc_html__( 'Via Name', 'jnews' ),
'description' => esc_html__( 'This via name will show at the end of the post content.', 'jnews' ),
),
array(
'type' => 'jnews-url',
'id' => 'via_url',
'label' => esc_html__( 'Via URL', 'jnews' ),
'description' => esc_html__( 'Insert via url link.', 'jnews' ),
),
),
);
$post_format_field = array(
'type' => 'jnews-select',
'id' => 'format',
'default' => $post_format ? $post_format : 'standard',
'label' => esc_html__( 'Post Format Type', 'jnews' ),
'description' => esc_html__( 'Choose post format type for the current post.', 'jnews' ),
'choices' => array(
array(
'value' => 'standard',
'label' => esc_attr__( 'Standard', 'jnews' ),
),
array(
'value' => 'gallery',
'label' => esc_attr__( 'Gallery', 'jnews' ),
),
array(
'value' => 'video',
'label' => esc_attr__( 'Video', 'jnews' ),
),
),
);
$general_setting['fields'] = array_merge( array( $post_format_field ), $general_setting['fields'] );
$general_setting['fields'] = apply_filters( 'jnews_add_post_general_metabox_field', $general_setting['fields'] );
array_unshift( $options['fields'], $general_setting );
return $options;
}
/**
* Method primary_category
*
* @return array
*/
public function primary_category_meta() {
$post_id = isset( $_REQUEST['post'] ) ? $_REQUEST['post'] : '';
$primary_category = jnews_get_metabox_value( 'jnews_primary_category.id', null, $post_id );
$cat = get_term( $primary_category );
if ( empty( $primary_category ) && ! isset( $cat ) ) {
$primary_category = false;
}
return array(
'id' => 'jnews_primary_category',
'post_types' => array( 'post' ),
'label' => esc_html__( 'Primary Category', 'jnews' ),
'priority' => 'high',
'context' => 'side',
'icon' => 'LabelSvg',
'fields' => array(
array(
'type' => 'jnews-select-search',
'id' => 'id',
'default' => $primary_category ? $primary_category : '',
'label' => esc_html__( 'Primary Category', 'jnews' ),
'description' => wp_kses( __( 'You can search the post category by inputting the category name, clicking search result, and you will have your post category.
Primary category will show as your breadcrumb category on single Blog Post.
Other page that require single category to show, this category will be used.', 'jnews' ), wp_kses_allowed_html() ),
'isMulti' => false,
'onSearch' => 'searchCategoriesByTitleAndId',
),
array(
'type' => 'jnews-select-search',
'id' => 'hide',
'label' => esc_html__( 'Hide Category', 'jnews' ),
'description' => wp_kses( __( 'You can search the post category by inputting the category name, clicking search result, and you will have your post category.
Hide category will not show your category on single Blog Post.', 'jnews' ), wp_kses_allowed_html() ),
'multiple' => PHP_INT_MAX,
'isMulti' => false,
'onSearch' => 'searchCategoriesByTitleAndId',
),
),
);
}
}