'ffffff',
));
add_image_size( 'agriculture-farming-featured-image', 2000, 1200, true );
add_image_size( 'agriculture-farming-thumbnail-avatar', 100, 100, true );
$GLOBALS['content_width'] = 525;
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'agriculture-farming' ),
) );
add_theme_support( 'html5', array(
'comment-form',
'comment-list',
'gallery',
'caption',
) );
// Add theme support for Custom Logo.
add_theme_support( 'custom-logo', array(
'width' => 250,
'height' => 250,
'flex-width' => true,
) );
/*
* This theme styles the visual editor to resemble the theme style,
* specifically font, colors, and column width.
*/
add_editor_style( array( 'assets/css/editor-style.css', organic_farm_fonts_url() ) );
}
add_action( 'after_setup_theme', 'agriculture_farming_setup' );
function agriculture_farming_widgets_init() {
register_sidebar( array(
'name' => __( 'Sidebar', 'agriculture-farming' ),
'id' => 'sidebar-1',
'description' => __( 'Add widgets here to appear in your sidebar on blog posts and archive pages.', 'agriculture-farming' ),
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => __( 'Page Sidebar', 'agriculture-farming' ),
'id' => 'sidebar-2',
'description' => __( 'Add widgets here to appear in your pages and posts', 'agriculture-farming' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer 1', 'agriculture-farming' ),
'id' => 'footer-1',
'description' => __( 'Add widgets here to appear in your footer.', 'agriculture-farming' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer 2', 'agriculture-farming' ),
'id' => 'footer-2',
'description' => __( 'Add widgets here to appear in your footer.', 'agriculture-farming' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer 3', 'agriculture-farming' ),
'id' => 'footer-3',
'description' => __( 'Add widgets here to appear in your footer.', 'agriculture-farming' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer 4', 'agriculture-farming' ),
'id' => 'footer-4',
'description' => __( 'Add widgets here to appear in your footer.', 'agriculture-farming' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Product Category Dropdown', 'agriculture-farming' ),
'id' => 'product-cat',
'description' => __( 'Add widgets here to appear in your header.', 'agriculture-farming' ),
'before_widget' => '',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'agriculture_farming_widgets_init' );
function agriculture_farming_customize_register() {
global $wp_customize;
$wp_customize->remove_section( 'organic_farm_pro' );
$wp_customize->remove_section( 'organic_farm_middle_section' );
$wp_customize->remove_section( 'organic_farm_product_box_section' );
$wp_customize->remove_setting( 'organic_farm_call_text' );
$wp_customize->remove_control( 'organic_farm_call_text' );
$wp_customize->remove_setting( 'organic_farm_email_text' );
$wp_customize->remove_control( 'organic_farm_email_text' );
$wp_customize->remove_setting( 'organic_farm_quote_btn' );
$wp_customize->remove_control( 'organic_farm_quote_btn' );
$wp_customize->remove_setting( 'organic_farm_quote_btn_link' );
$wp_customize->remove_control( 'organic_farm_quote_btn_link' );
}
add_action( 'customize_register', 'agriculture_farming_customize_register', 11 );
function agriculture_farming_customize( $wp_customize ) {
wp_enqueue_style('customizercustom_css', esc_url( get_stylesheet_directory_uri() ). '/assets/css/customizer.css');
$wp_customize->add_section('agriculture_farming_pro', array(
'title' => __('UPGRADE AGRICULTURE PREMIUM', 'agriculture-farming'),
'priority' => 1,
));
$wp_customize->add_setting('agriculture_farming_pro', array(
'default' => null,
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control(new Agriculture_Farming_Pro_Control($wp_customize, 'agriculture_farming_pro', array(
'label' => __('AGRICULTURE PREMIUM', 'agriculture-farming'),
'section' => 'agriculture_farming_pro',
'settings' => 'agriculture_farming_pro',
'priority' => 1,
)));
//Category Section
$wp_customize->add_section('agriculture_farming_category_section',array(
'title' => __('Category Section','agriculture-farming'),
'description'=> __('This section will appear below the category.','agriculture-farming'),
));
$wp_customize->add_setting('agriculture_farming_grocery_cate_title',array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('agriculture_farming_grocery_cate_title',array(
'label' => __('Section Title','agriculture-farming'),
'section' => 'agriculture_farming_category_section',
'type' => 'text'
));
$agriculture_farming_categories = get_categories();
$agriculture_farming_cats = array();
$agriculture_farming_i = 0;
$agriculture_farming_cat_pst[]= 'select';
foreach($agriculture_farming_categories as $category){
if($agriculture_farming_i==0){
$default = $category->slug;
$agriculture_farming_i++;
}
$agriculture_farming_cat_pst[$category->slug] = $category->name;
}
$wp_customize->add_setting('agriculture_farming_category_setting',array(
'default' => 'select',
'sanitize_callback' => 'organic_farm_sanitize_choices',
));
$wp_customize->add_control('agriculture_farming_category_setting',array(
'type' => 'select',
'choices' => $agriculture_farming_cat_pst,
'label' => __('Select Category to display Post','agriculture-farming'),
'section' => 'agriculture_farming_category_section',
));
$wp_customize->selective_refresh->add_partial( 'agriculture_farming_category_setting', array(
'selector' => '#home-mission h3',
'render_callback' => 'agriculture_farming_customize_partial_agriculture_farming_category_setting',
) );
}
add_action( 'customize_register', 'agriculture_farming_customize' );
function agriculture_farming_enqueue_comments_reply() {
if( is_singular() && comments_open() && ( get_option( 'thread_comments' ) == 1) ) {
// Load comment-reply.js (into footer)
wp_enqueue_script( 'comment-reply', '/wp-includes/js/comment-reply.min.js', array(), false, true );
}
}
add_action( 'wp_enqueue_scripts', 'agriculture_farming_enqueue_comments_reply' );
if ( ! defined( 'AGRICULTURE_FARMING_PRO_LINK' ) ) {
define('AGRICULTURE_FARMING_PRO_LINK',__('https://www.ovationthemes.com/wordpress/farming-wordpress-theme/','agriculture-farming'));
}
/* Pro control */
if (class_exists('WP_Customize_Control') && !class_exists('Agriculture_Farming_Pro_Control')):
class Agriculture_Farming_Pro_Control extends WP_Customize_Control{
public function render_content(){?>