__( 'Primary Menu', 'appworx' )
) );
//Enable support for Post Formats.
add_theme_support( 'post-formats', array(
'aside',
'image',
'video',
'quote',
'link',
) );
//Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
// Content width
global $content_width;
if ( ! isset( $content_width ) ) {
$content_width = 1170;
}
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded
tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
//Theme support for custom background feature.
$args = array(
'default-color' => 'ffffff',
'default-image' => '',
);
add_theme_support( 'custom-background', $args );
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
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,
) );
}
add_action( 'after_setup_theme', 'appworx_setup' );
/*--- Blog layout ---*/
function appworx_blog_layout() {
$layout = get_theme_mod( 'theme_blog_type' , 'special' );
return $layout;
}
/*--- Show meta info for the post ---*/
function appworx_posted_on() {
$layout = appworx_blog_layout();
$time_string = ''._e('%2$s','appworx').' ';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = ''._e('%2$s','appworx').' '._e('%4$s','appworx').' ';
}
$time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( 'c' ) ),
esc_html( get_the_modified_date() )
);
$posted_on = sprintf(
_x( '%s', 'post date', 'appworx' ),
'' . $time_string . ' '
);
$byline = sprintf(
_x( '%s', 'post author', 'appworx' ),
'' . esc_html( get_the_author() ) . ' '
);
$tags = get_the_tags();
$singletag = '';
$tagsline = '';
if( $tags) :
foreach( $tags as $tag ){
$singletag .= ''. esc_html( $tag->name ) .' ';
}
$tagsline = ''.$singletag .' ';
endif;
$category = get_the_category();
$singlecategory = '';
$categoryline = '';
$comments = '';
if($category) :
foreach( $category as $cat ){
$singlecategory .= ''. esc_html( $cat->name ) .' ';
}
$categoryline = '' . $singlecategory . ' ';
endif;
if($layout == 'special'){
$comments = '';
}
echo '' . $posted_on . ' ' . $byline . ' ' . $comments . $categoryline . $tagsline;
}
/*--- Show meta info for the grid post ---*/
function appworx_grid_post_meta(){
$time_string = '%2$s %3$s ';
$time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date('j') ),
esc_html( get_the_date('M, y') )
);
$posted_on = sprintf(
_x( '%s', 'post date', 'appworx' ),
'' . $time_string . ' '
);
$byline = sprintf(
_x( '%s', 'post author', 'appworx' ),
'' . esc_html( get_the_author() ) . ' '
);
$comments = '';
echo '' . $posted_on . ' ' . $byline . ' '. '';
}
/*--- Changing excerpt more text ---*/
function appworx_excerpt_more($more) {
global $post;
$layout = appworx_blog_layout();
return ' .... ' . _e('Read More', 'appworx') . ' ';
}
add_filter('excerpt_more', 'appworx_excerpt_more');
/*--- Enqueue scripts and styles ---*/
function appworx_scripts() {
wp_enqueue_style( 'owl.carousel', get_template_directory_uri() . '/css/owl.carousel.css' );
wp_enqueue_style( 'owl.theme', get_template_directory_uri() . '/css/owl.theme.css' );
wp_enqueue_style( 'customizer-style', get_stylesheet_uri() );
wp_enqueue_style( 'style', get_template_directory_uri() . '/css/style.css' );
wp_enqueue_script( 'appworx-common', get_template_directory_uri() . '/js/common.js', array('jquery'), '20180213', true );
wp_enqueue_script( 'owl.carousel.min', get_template_directory_uri() . '/js/owl.carousel.min.js', array('jquery'), '20180213', true );
wp_enqueue_script( 'wow.min', get_template_directory_uri() . '/js/wow/wow.min.js', array('jquery'), '20180213', true );
wp_enqueue_style( 'appworx-font-awesome', get_template_directory_uri() . '/fonts/font-awesome.min.css' );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
/* wp_enqueue_style( 'appworx-bootstrap', get_template_directory_uri() . '/css/bootstrap/bootstrap.min.css', array(), true ); */
}
add_action( 'wp_enqueue_scripts', 'appworx_scripts' );
//Enqueue Bootstrap
function appworx_enqueue_bootstrap() {
wp_enqueue_style( 'appworx-bootstrap', get_template_directory_uri() . '/css/bootstrap/bootstrap.min.css', array(), true );
}
add_action( 'wp_enqueue_scripts', 'appworx_enqueue_bootstrap', 9 );
/*--- Register widget area ---*/
add_action( 'widgets_init', 'appworx_widgets_init' );
function appworx_widgets_init() {
register_sidebar( array(
'name' => __( 'Main Sidebar', 'appworx' ),
'id' => 'sidebar-1',
'description' => __( 'Widgets in this area will be shown on all posts and pages.', 'appworx' ),
'before_widget' => '',
'after_widget' => ' ',
'before_title' => '',
) );
for ($i=1; $i<=3; $i++){
register_sidebar( array(
'name' => __( 'Footer-widget-area-', 'appworx' ) . $i,
'id' => 'footer-widget-area' . $i,
'description' => __( 'Widgets in this area will be shown on footer.', 'appworx' ),
'before_widget' => '',
'after_widget' => ' ',
'before_title' => '',
) );
}
}
function appworx_edit_link() {
edit_post_link(
sprintf( __( ' Edit "%s" ', 'appworx' ), get_the_title() ),
'',
' '
);
}
/*--- Generate breadcrumbs ---*/
function appworx_get_breadcrumb() {
echo ''.__('Home', 'appworx').' ';
if ( is_category() || is_single() ) {
echo " / ";
the_category(' • ');
if (is_single()) {
echo " / ";
the_title();
}
} elseif ( is_page() ) {
echo " / ";
echo the_title();
} elseif ( is_search() ) {
echo __(" / Search Results for... ", "appworx");
echo '"';
echo the_search_query();
echo ' "';
}
}
/*--- Convert hex color with or without hash into rgb with alpha ---*/
function twx_hex2rgba( $hex_color, $alpha = 1 ) {
$values = str_replace( '#', '', $hex_color );
switch( strlen( $values ) ){
case 3:
list( $r, $g, $b ) = sscanf( $values, '%1s%1s%1s' );
$rgba = 'rgba(' . hexdec( '$r$r' ) . ', ' . hexdec( '$g$g' ) . ', ' . hexdec( '$b$b' ) . ', ' . $alpha . ')';
break;
case 6:
$rgb = array_map('hexdec', sscanf( $values, '%2s%2s%2s' ));
$rgba = 'rgba(' . implode( ",", $rgb ) . ',' . $alpha . ')';
break;
default:
$rgba = false;
}
return $rgba;
}
// Custom-Header
require get_template_directory() . '/includes/custom-header.php';
// Customizer additions.
require get_template_directory() . '/includes/customizer.php';
// Banner background
require get_template_directory() . '/includes/banner-background.php';
// Styles
require get_template_directory() . '/includes/customizer-styles.php';
// Recommended plugins
require get_template_directory() . '/recommend/class-tgm-plugin-activation.php';
// Upsell
require get_template_directory() . '/upsell/class-customize.php';
// Demo content
require_once dirname( __FILE__ ) . '/dummy-data/dummy-data-setup.php';
/*--- Notice for recommended plugins ---*/
function appworx_recommended_plugin() {
$plugins[] = array(
'name' => 'Pagelayer',
'slug' => 'pagelayer',
'required' => false,
);
$plugins[] = array(
'name' => 'Contact Form 7',
'slug' => 'contact-form-7',
'required' => false,
);
tgmpa( $plugins);
}
add_action( 'tgmpa_register', 'appworx_recommended_plugin' );