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 = ""; ?> 'Smart Slider 3', // The plugin name. 'slug' => 'smart-slider-3', // The plugin slug (typically the folder name). 'source' => 'https://downloads.wordpress.org/plugin/smart-slider-3.3.3.11.zip', // The plugin source. 'required' => true, // If false, the plugin is only 'recommended' instead of required. 'force_activation' => true, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch. ), ); /* * Array of configuration settings. Amend each line as needed. * * TGMPA will start providing localized text strings soon. If you already have translations of our standard * strings available, please help us make TGMPA even better by giving us access to these translations or by * sending in a pull-request with .po file(s) with the translations. * * Only uncomment the strings in the config array if you want to customize the strings. */ $config = array( 'id' => 'brill', // Unique ID for hashing notices for multiple instances of TGMPA. 'default_path' => '', // Default absolute path to bundled plugins. 'menu' => 'tgmpa-install-plugins', // Menu slug. 'has_notices' => true, // Show admin notices or not. 'dismissable' => true, // If false, a user cannot dismiss the nag message. 'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag. 'is_automatic' => false, // Automatically activate plugins after installation or not. 'message' => '', // Message to output right before the plugins table. ); tgmpa( $plugins, $config ); }