75, 'width' => 300, 'flex-height' => true, 'flex-width' => true, 'header-text' => array( 'site-title', 'site-description' ) , ); add_theme_support('custom-logo', $defaults); add_theme_support('post-formats', array( 'aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio', 'chat' )); add_theme_support('woocommerce'); add_filter('woocommerce_enqueue_styles', '__return_empty_array'); } add_action('after_setup_theme', 'brill_theme_support'); // dashborad support widget add_action('wp_dashboard_setup', 'brill_dashborad_widget'); function brill_dashborad_widget() { wp_add_dashboard_widget('dashboard_1', 'Need Help?', 'brill_contact_widget', null, null); } function brill_contact_widget() { echo "Contact Brill Infotech for any help"; } // register menu function brill_register_menus() { register_nav_menus(array( 'primary-menu' => __('Primary Menu', 'brill') , 'footer-menu' => __('Footer Menu', 'brill') , 'social-menu' => __('Social Menu', 'brill') )); } add_action('init', 'brill_register_menus'); // set copyright text function create_copyright() { echo '
'; echo get_option('brill_footer_copyright_text'); echo '
'; } // register sidebars function brill_widgets_init() { register_sidebar(array( 'name' => sprintf(esc_html__('Home Top Widget Area', 'brill') , 1) , 'id' => 'home-2', 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '', )); register_sidebar(array( 'name' => sprintf(esc_html__('Home Services Widget Area', 'brill') , 1) , 'id' => 'home-1', 'before_widget' => '', 'after_widget' => '', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'name' => sprintf(esc_html__('Blog Side bar', 'brill') , 1) , 'id' => 'sidebar-1', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'name' => sprintf(esc_html__('Footer Widget', 'brill') , 1) , 'id' => 'footer-1', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '
', 'after_title' => '
', )); } add_action('widgets_init', 'brill_widgets_init'); // extend widgets class Brill_Services_Widget extends WP_Widget { /** * Register widget with WordPress. */ function __construct() { $widget_ops = array( 'classname' => 'brill_widget', 'description' => 'Use thiss widget to show service section at home page', ); parent::__construct('brill_widget', 'Brill: Home Service', $widget_ops); } /** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget($args, $instance) { $ctaPage = $instance['cta_page'] ? get_page_link($instance['cta_page']) : ''; echo $args['before_widget']; echo "
"; if (!empty($instance['title'])) { echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title']; } if (!empty($instance['desc'])) { echo $instance['desc']; } echo "
"; echo $args['after_widget']; } /** * Back-end widget form. * * @see WP_Widget::form() * * @param array $instance Previously saved values from database. */ public function form($instance) { $title = !empty($instance['title']) ? $instance['title'] : esc_html__('Enter title', 'brill'); $desc = !empty($instance['desc']) ? $instance['desc'] : esc_html__('Enter description here', 'brill'); $instance['cta_page'] = !empty($instance['cta_page']) ? $instance['cta_page'] : "1" ?>

$this->get_field_id('cta_page') , 'class' => 'widefat', 'name' => $this->get_field_name('cta_page') , 'selected' => $instance['cta_page'], 'show_option_none' => esc_html__('— Select —', 'brill') , ));; ?> site_url() . '/wp-admin/admin-ajax.php', // WordPress AJAX 'posts' => json_encode($wp_query->query_vars) , // everything about your loop is here 'current_page' => get_query_var('paged') ? get_query_var('paged') : 1, 'max_page' => $wp_query->max_num_pages )); wp_enqueue_script('my_loadmore'); } add_action('wp_enqueue_scripts', 'brill_load_more_scripts'); function brill_loadmore_ajax_handler() { // prepare our arguments for the query $args = json_decode(stripslashes($_POST['query']) , true); $args['paged'] = $_POST['page'] + 1; // we need next page to be loaded $args['post_status'] = 'publish'; // it is always better to use WP_Query but not here query_posts($args); if (have_posts()): // run the loop while (have_posts()): the_post(); get_template_part('template-parts/content', get_post_format()); endwhile; endif; die; } add_action('wp_ajax_loadmore', 'brill_loadmore_ajax_handler'); // wp_ajax_{action} add_action('wp_ajax_nopriv_loadmore', 'brill_loadmore_ajax_handler'); // wp_ajax_nopriv_{action} function brill_customize_register($wp_customize) { $wp_customize->add_section('brill_home_settings', array( 'title' => 'Home page content & settings', 'description' => '', 'priority' => 1, )); // ============================= // = Text Input = // ============================= $wp_customize->add_setting('brill_services_heading', array( 'default' => 'Our Services', 'capability' => 'edit_theme_options', 'type' => 'option', 'sanitize_callback' => 'esc_attr' )); $wp_customize->add_control('brill_service_heading_control', array( 'label' => "Service Section Heading", 'section' => 'brill_home_settings', 'settings' => 'brill_services_heading', )); $wp_customize->add_setting('brill_services_desc', array( 'default' => 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.', 'capability' => 'edit_theme_options', 'type' => 'option', 'sanitize_callback' => 'esc_attr' )); $wp_customize->add_control('brill_service_desc_control', array( 'label' => "Service Section short Description", 'section' => 'brill_home_settings', 'settings' => 'brill_services_desc', )); $wp_customize->add_setting('brill_recent_post_heading', array( 'default' => 'Recent Post', 'capability' => 'edit_theme_options', 'type' => 'option', 'sanitize_callback' => 'esc_attr' )); $wp_customize->add_control('brill_recent_post_heading_control', array( 'label' => "Recent Post section Heading", 'section' => 'brill_home_settings', 'settings' => 'brill_recent_post_heading', )); $wp_customize->add_setting('brill_blog_btn_text', array( 'default' => 'All Post', 'capability' => 'edit_theme_options', 'type' => 'option', 'sanitize_callback' => 'esc_attr' )); $wp_customize->add_control('brill_blog_btn_text_control', array( 'label' => "Recent Post button text", 'section' => 'brill_home_settings', 'settings' => 'brill_blog_btn_text', )); $wp_customize->add_setting('brill_footer_copyright_text', array( 'default' => 'copyright brillinfotech.com', 'capability' => 'edit_theme_options', 'type' => 'option', 'sanitize_callback' => 'esc_attr' )); $wp_customize->add_control('brill_footer_copyright_text_control', array( 'label' => "Footer Copyright Text", 'section' => 'brill_home_settings', 'settings' => 'brill_footer_copyright_text', )); } add_action('customize_register', 'brill_customize_register'); function wp_get_attachment($attachment_id) { $attachment = get_post($attachment_id); return array( 'alt' => get_post_meta($attachment->ID, '_wp_attachment_image_alt', true) , 'caption' => $attachment->post_excerpt, 'description' => $attachment->post_content, 'href' => get_permalink($attachment->ID) , 'src' => $attachment->guid, 'title' => $attachment->post_title ); } add_filter('post_gallery', 'customFormatGallery', 10, 2); function customFormatGallery($string, $attr) { $output = ""; ?>

'; $msg[] = sprintf('%s: ',$current_theme->Name); $msg[] = sprintf('Failed to parse json string in "%s", error: "%s"', $plugins_data_file , $errormsg); $msg[] = '

'; echo implode( PHP_EOL, $msg ); }); } } /** * Array of configuration settings. Amend each line as needed. * If you want the default strings to be available under your own theme domain, * leave the strings uncommented. * Some of the strings are added into a sprintf, so see the comments at the * end of each line for what each argument will be. */ $config = array( 'default_path' => '', // Default absolute path to pre-packaged plugins. 'menu' => 'brill-install-plugins', // Menu slug. 'has_notices' => true, // Show admin notices or not. 'dismissable' => false, // If false, a user cannot dismiss the nag message. 'dismiss_msg' => sprintf('

%s

%s

',$current_theme->Name, $current_theme->Description), // If 'dismissable' is false, this message will be output at top of nag. 'is_automatic' => true, // Automatically activate plugins after installation or not. 'message' => sprintf('

%s

%s

',$current_theme->Name, $current_theme->Description), // Message to output right before the plugins table. 'strings' => array( 'page_title' => __( 'Install Required Plugins', 'brill' ), 'menu_title' => __( 'Install Plugins', 'brill' ), 'installing' => __( 'Installing Plugin: %s', 'brill' ), // %s = plugin name. 'oops' => __( 'Something went wrong with the plugin API.', 'brill' ), 'notice_can_install_required' => _n_noop( 'This theme requires the following plugin: %1$s.', 'This theme requires the following plugins: %1$s.' , 'brill' ), // %1$s = plugin name(s). 'notice_can_install_recommended' => _n_noop( 'This theme recommends the following plugin: %1$s.', 'This theme recommends the following plugins: %1$s.', 'brill' ), // %1$s = plugin name(s). 'notice_cannot_install' => _n_noop( 'Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'Sorry, but you do not have the correct permissions to install the %s plugins. Contact the administrator of this site for help on getting the plugins installed.', 'brill' ), // %1$s = plugin name(s). 'notice_can_activate_required' => _n_noop( 'The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.', 'brill' ), // %1$s = plugin name(s). 'notice_can_activate_recommended' => _n_noop( 'The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.', 'brill' ), // %1$s = plugin name(s). 'notice_cannot_activate' => _n_noop( 'Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'Sorry, but you do not have the correct permissions to activate the %s plugins. Contact the administrator of this site for help on getting the plugins activated.', 'brill' ), // %1$s = plugin name(s). 'notice_ask_to_update' => _n_noop( 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.', 'brill' ), // %1$s = plugin name(s). 'notice_cannot_update' => _n_noop( 'Sorry, but you do not have the correct permissions to update the %s plugin. Contact the administrator of this site for help on getting the plugin updated.', 'Sorry, but you do not have the correct permissions to update the %s plugins. Contact the administrator of this site for help on getting the plugins updated.', 'brill' ), // %1$s = plugin name(s). 'install_link' => _n_noop( 'Begin installing plugin', 'Begin installing plugins', 'brill' ), 'activate_link' => _n_noop( 'Begin activating plugin', 'Begin activating plugins', 'brill' ), 'return' => __( 'Return to Required Plugins Installer', 'brill' ), 'plugin_activated' => __( 'Plugin activated successfully.', 'brill' ), 'complete' => __( 'All plugins installed and activated successfully. %s', 'brill' ), // %s = dashboard link. 'nag_type' => 'updated' // Determines admin notice type - can only be 'updated', 'update-nag' or 'error'. ) ); brill( $plugins, $config ); } ?>