tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support( 'post-thumbnails' );
/**
* Enable support for woocommerce
*/
add_theme_support( 'woocommerce' );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary', 'business-hub' ),
'social' => esc_html__( 'Social Menu', 'business-hub' ),
'footer' => esc_html__( 'Footer Menu', 'business-hub' ),
) );
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
) );
/*
* Enable support for Post Formats.
* See https://developer.wordpress.org/themes/functionality/post-formats/
*/
add_theme_support( 'post-formats', array(
'aside',
'image',
'video',
'quote',
'link',
) );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'rws_business_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
add_image_size( 'rws-homepage-blog-thumb', 340, 190, true );
}
endif;
add_action( 'after_setup_theme', 'rws_business_setup' );
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
function rws_business_content_width() {
$GLOBALS['content_width'] = apply_filters( 'rws_business_content_width', 840 );
}
add_action( 'after_setup_theme', 'rws_business_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function rws_business_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'business-hub' ),
'id' => 'sidebar-1',
'description' => '',
'before_widget' => '',
'before_title' => '
',
) );
}
add_action( 'widgets_init', 'rws_business_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function rws_business_scripts() {
wp_enqueue_style( 'rws-business-style', get_stylesheet_uri() );
wp_enqueue_style( 'rws-business-fa', get_template_directory_uri().'/css/font-awesome.css', array(), '1.0.0',null);
// adding fonts
$query_args = array(
'family' => 'Merriweather:300,400,400italic,700italic%7CUbuntu:300,400,500',
);
wp_register_style( 'rws-business-google_fonts', add_query_arg( $query_args, "//fonts.googleapis.com/css" ), array() , null );
wp_enqueue_style ( 'rws-business-google_fonts' );
wp_enqueue_script( 'rws-business-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true );
wp_enqueue_script( 'rws-business-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
wp_enqueue_script( 'rws-business-slider-min', get_template_directory_uri().'/js/rws-slider.js', array ( 'jquery' ), '1.0.0', true );
wp_enqueue_script( 'rws-custom', get_template_directory_uri().'/js/rws-custom.js', array ( 'jquery', 'rws-business-slider-min'), '1.0.0', true );
}
add_action( 'wp_enqueue_scripts', 'rws_business_scripts' );
/**
* @param $length
* @param $post_object
* @return int
*/
function rws_business_blog_excerpt( $length = 35, $post_object = null )
{
global $post;
if ( is_null( $post_object ) ) {
$post_object = $post;
}
$length = absint( $length );
if ( $length < 1 ) {
$length = 35;
}
$content = $post_object->post_content;
$excerpt = wp_trim_words( $content, $length, '...' );
return $excerpt;
}
/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/inc/custom-header.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/inc/extras.php';
/**
* Customizer Functions
*/
require get_template_directory() . '/inc/customizer/customizer-functions.php';
/**
* Custom Hook functions
*/
require get_template_directory() . '/inc/hooks/hook-functions.php';
require get_template_directory() . '/inc/hooks/homepage-hooks.php';
/**
* Load Jetpack compatibility file.
*/
require get_template_directory() . '/inc/jetpack.php';
/**
* Admin notices for suggested plugins
* @return void
*/
function rws_business_notices(){
//check if plugin is active
if ( is_plugin_active( 'contact-form-7/wp-contact-form-7.php') && is_plugin_active( 'woocommerce/woocommerce.php' ) ){
return ;
}
// getting current page on screen
$screen = get_current_screen();
// check if dashboard or themes page
if ( ( $screen->base === 'dashboard' || $screen->base === 'themes' ) && function_exists( 'rws_business_setup' ) ) :
?>
Contact Form 7 And Woocommerce Dismiss this notice. ', 'business-hub' );?>
comment_type);
// Get the comment HTML from my custom comment HTML function
$commentContent = getCommentHTML($comment);
// Kill the script, returning the comment HTML
die($commentContent);
}
}// Send all comment submissions through my "ajaxComment" method
add_action('comment_post', 'ajaxComment', 20, 2);