'Instagram Slider Widget',
'slug' => 'instagram-slider-widget',
'required' => false,
),
// Facebook Widget
array(
'name' => 'Facebook Widget',
'slug' => 'facebook-pagelike-widget',
'required' => false,
),
// Contact Form 7
array(
'name' => 'Contact Form 7',
'slug' => 'contact-form-7',
'required' => false,
),
//Lightweight Social Icons
array(
'name' => 'Lightweight Social Icons',
'slug' => 'lightweight-social-icons',
'required' => false,
),
// Royal Backend Gallery
array(
'name' => 'Royal Backend Gallery',
'slug' => 'royal-backend-gallery',
'source' => ADENIT_THEMEROOT . '/plugins/royal-backend-gallery.zip',
'required' => true,
'version' => '1.0',
'force_activation' => false,
'force_deactivation' => false,
'external_url' => '',
),
// Royal Backend Gallery
array(
'name' => 'Envato Wordpress Toolkit Master',
'slug' => 'envato-wordpress-toolkit-master',
'source' => ADENIT_THEMEROOT . '/plugins/envato-wordpress-toolkit-master.zip',
'required' => true,
'version' => '1.0',
'force_activation' => false,
'force_deactivation' => false,
'external_url' => '',
),
);
tgmpa( $plugins );
}
}
add_action( 'tgmpa_register', 'adenit_tgm_activation' );
/**
* ----------------------------------------------------------------------------------------
* Set up theme default / supported features
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'adenit_setup' ) ) {
function adenit_setup() {
// Title Support
add_theme_support('title-tag');
// Add support for post formats
add_theme_support( 'post-formats',
array(
'gallery',
'link',
'quote',
'video',
'audio'
)
);
// Register nav menus
register_nav_menus(
array(
'top-menu' => esc_html__( 'Top Menu', 'aden' ),
'main-menu' => esc_html__( 'Main Menu', 'aden' )
)
);
// Content Width
if ( ! isset( $content_width ) ) {
$content_width = 960;
}
}
add_action( 'after_setup_theme', 'adenit_setup' );
}
// Load Language File For Translation
load_theme_textdomain( 'aden', ADENIT_THEMEROOT .'/languages' );
// Add support for automatic feed links
add_theme_support( 'automatic-feed-links' );
// Add support for post thumbnails
add_theme_support( 'post-thumbnails' );
// Image Size
add_image_size( 'adenit-post-carousel', 800, 500, true );
add_image_size( 'adenit-post-thumbnail', 825, 550, true );
add_image_size( 'adenit-pagination-thumbnail', 380, 120, true );
add_image_size( 'adenit-search-thumbnail', 250, 190, true );
/**
* ----------------------------------------------------------------------------------------
* Register the widgets
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'adenit_widget_init' ) ) {
function adenit_widget_init() {
if ( function_exists( 'register_sidebar' ) ) {
register_sidebar(
array(
'name' => esc_html__( 'Sidebar Widget Area', 'aden' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Appears on posts and pages.', 'aden' ),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
'after_title' => ' '
)
);
register_sidebar(
array(
'name' => esc_html__( 'Instagram Widget Area', 'aden' ),
'id' => 'sidebar-2',
'description' => esc_html__( 'Appears on posts and pages.', 'aden' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '
',
'after_title' => ' '
)
);
register_sidebar(
array(
'name' => esc_html__( 'Fixed Sidebar Widget Area', 'aden' ),
'id' => 'sidebar-3',
'description' => esc_html__( 'Appears on posts and pages.', 'aden' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '
',
'after_title' => ' '
)
);
}
}
add_action( 'widgets_init', 'adenit_widget_init' );
}
/**
* ----------------------------------------------------------------------------------------
* Custom Excerpt Length
* ----------------------------------------------------------------------------------------
*/
function adenit_excerpt_length( $length = 50 ) {
$post_fullwidth_value = get_post_meta( get_the_ID(), 'post-fullwidth-checkbox', true );
$content_options = get_option( 'adenit_content' );
if ( is_home() ) {
if( $post_fullwidth_value ){
return ( 3 * (int)$content_options['post_excerpt_length'] );
}
return $content_options['post_excerpt_length'];
}
if ( is_search() ) {
return 60;
}
return $length;
}
add_filter( 'excerpt_length', 'adenit_excerpt_length', 999 );
function adenit_new_excerpt( $more ) {
return '...';
}
add_filter( 'excerpt_more', 'adenit_new_excerpt' );
/**
* ----------------------------------------------------------------------------------------
* Adding Post & Page Classes
* ----------------------------------------------------------------------------------------
*/
function adenit_post_classes( $classes, $class, $post_id ) {
if( is_single() ) {
$classes[] .= 'adenit-single-post';
} else if ( is_page() ) {
$classes[] .= 'adenit-page col-1';
} else {
$classes[] .= 'main-post';
}
return $classes;
}
add_filter( 'post_class', 'adenit_post_classes', 10, 3 );
/**
* ----------------------------------------------------------------------------------------
* Adding Body Classes
* ----------------------------------------------------------------------------------------
*/
function adenit_body_classes( $classes ) {
$header_options = get_option( 'adenit_header' );
$classes[] = ( $header_options['effect'])?'animsition':'';
return $classes;
}
add_filter( 'body_class','adenit_body_classes' );
/**
* ----------------------------------------------------------------------------------------
* Custom Search Form
* ----------------------------------------------------------------------------------------
*/
function adenit_search_form( $search_value ) {
if ( $search_value === 'header' ) {
$form = '';
} else {
$form = '';
$form .= '';
$form .= '
';
}
return $form;
}
add_filter( 'get_search_form', 'adenit_search_form' );
/**
* ----------------------------------------------------------------------------------------
* Nav Menu Function
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'adenit_nav_menu' ) ) {
function adenit_nav_menu( $adenit_nav_class = '', $adenit_theme_location = '', $adenit_depth = 0 ) {
if ( has_nav_menu( $adenit_theme_location ) ) {
wp_nav_menu( array(
'theme_location' => $adenit_theme_location,
'container' => 'nav',
'container_class' => $adenit_nav_class,
'menu_class' => '',
'depth' => $adenit_depth
));
} else {
echo '';
echo '';
echo ' ';
}
}
}
/**
* ----------------------------------------------------------------------------------------
* Header Bottom Function
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'adenit_header_bottom' ) ) {
function adenit_header_bottom( $header_bottom_class = 'header-bottom' ) {
// Get Option
$header_options = get_option( 'adenit_header' );
?>
max_num_pages;
if( !$pages ) {
$pages = 1;
}
}
if ( 1 != $pages ) {
if ( $paged > 2 && $paged > $range+1 && $showitems < $pages ) {
echo " ";
}
if ( $paged > 1 ) {
echo " ";
}
for ( $i=1; $i <= $pages; $i++ ) {
if (1 != $pages &&( !( $i >= $paged+$range+1 || $i <= $paged-$range-1 ) || $pages <= $showitems ) ) {
echo ( $paged == $i )? "".$i." ":"".$i." ";
}
}
if ( $paged < $pages ) {
echo " ";
}
if ( $paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages ) {
echo " ";
}
}
}
}
/**
* ----------------------------------------------------------------------------------------
* Owl Carousel Function
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'adenit_carousel' ) ) {
function adenit_carousel( $carousel_class = '' ) {
if ( is_home() ) {
$carousel_options = get_option( 'adenit_carousel' );
$carousel_class .= ( $carousel_options['boxed']) ? 'center-max-width' : ''; ?>
'carousel-meta-checkbox'
)
);
$carusel_postlike_meta_array = array (
array(
'key' => '_post_like_count'
)
);
if ( $carousel_orderby === 'like' ) {
$carousel_orderby = 'meta_value_num';
$carusel_meta_array = array_merge( $carusel_postlike_meta_array, $carusel_meta_array );
}
// Query Args
$args = array(
'post_type' => $carusel_post_type,
'meta_query' => $carusel_meta_array,
'orderby' => $carousel_orderby,
'order' => 'DESC',
'showposts'=> '-1'
);
$latestPosts = new WP_Query();
$latestPosts->query( $args );
while( $latestPosts->have_posts() ) : $latestPosts->the_post();
// Retrieves the stored value from the database
$carousel_meta_value = get_post_meta( get_the_ID(), 'carousel-meta-checkbox', true );
// Checks and displays the retrieved value
if( !empty( $carousel_meta_value ) ) : ?>
';
if ( !is_single() && (false == get_post_format() || $content_options['post_thumbnail']) ) {
echo '';
echo ' ';
}
//Get Post Thumbnail
if ( $content_options['post_column'] === 'col-1' || is_single() || ( !empty( $post_fullwidth_value ) && is_home() ) ) {
the_post_thumbnail('full');
} else {
the_post_thumbnail( 'adenit-post-thumbnail' );
}
echo '';
}
}
}
/**
* ----------------------------------------------------------------------------------------
* Main Post
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'adenit_main_post' ) ) {
function adenit_main_post() {
//Get Options
$content_options = get_option( 'adenit_content' );
?>
'
' . esc_html__( 'Pages:', 'aden' ) . ' ',
'after' => '
',
'link_before' => '
',
'link_after' => ' ',
) );
}
if ( $content_options['post_read_more'] && !is_single() ) {
echo '
';
}
?>
'
' . esc_html__( 'Pages:', 'aden' ) . ' ',
'after' => '
',
'link_before' => '
',
'link_after' => ' ',
) );
if ( $content_options['post_read_more'] && !is_single() ) {
echo '
';
}
}
?>
';
if ( trim( $social_options['facebook'] ) !== '' ) {
$html .= '';
$html .= ' ';
$html .= ''. esc_html__( 'Facebook', 'aden' ) .' ';
$html .= ' ';
}
if ( trim( $social_options['google_plus'] ) !== '' ) {
$html .= '';
$html .= ' ';
$html .= ''. esc_html__( 'Google +', 'aden' ) .' ';
$html .= ' ';
}
if ( trim( $social_options['twitter'] ) !== '' ) {
$html .= '';
$html .= '';
$html .= ''. esc_html__( 'Twitter', 'aden' ) .' ';
$html .= ' ';
}
if ( trim( $social_options['youtube'] ) !== '' ) {
$html .= '';
$html .= ' ';
$html .= ''. esc_html__( 'Youtube', 'aden' ) .' ';
$html .= ' ';
}
if ( trim( $social_options['flickr'] ) !== '' ) {
$html .= '';
$html .= ' ';
$html .= ''. esc_html__( 'Flickr', 'aden' ) .' ';
$html .= ' ';
}
if ( trim( $social_options['linkedin'] ) !== '' ) {
$html .= '';
$html .= ' ';
$html .= ''. esc_html__( 'Linkedin', 'aden' ) .' ';
$html .= ' ';
}
if ( trim( $social_options['bloglovin'] ) !== '' ) {
$html .= '';
$html .= ' ';
$html .= ''. esc_html__( 'Bloglovin', 'aden' ) .' ';
$html .= ' ';
}
if ( trim( $social_options['tumblr'] ) !== '' ) {
$html .= '';
$html .= ' ';
$html .= ''. esc_html__( 'Tumblr', 'aden' ) .' ';
$html .= ' ';
}
if ( trim( $social_options['pinterest'] ) !== '' ) {
$html .= '';
$html .= ' ';
$html .= ''. esc_html__( 'Pinterest', 'aden' ) .' ';
$html .= ' ';
}
if ( trim( $social_options['behance'] ) !== '' ) {
$html .= '';
$html .= ' ';
$html .= ''. esc_html__( 'Behance', 'aden' ) .' ';
$html .= ' ';
}
if ( trim( $social_options['vimeo'] ) !== '' ) {
$html .= '';
$html .= ' ';
$html .= ''. esc_html__( 'Vimeo', 'aden' ) .' ';
$html .= ' ';
}
if ( trim( $social_options['instagram'] ) !== '' ) {
$html .= '';
$html .= ' ';
$html .= ''. esc_html__( 'Instagram', 'aden' ) .' ';
$html .= ' ';
}
$html .= '';
echo '' . $html;
}
}
/**
* ----------------------------------------------------------------------------------------
* Breadcrumb Section
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'adenit_breadcrumb' ) ) {
function adenit_breadcrumb () {
// Get Option
$content_options = get_option( 'adenit_content' );
if ( $content_options['breadcrumb'] ) {
// Settings
$separator = '/';
$id = 'adenit-breadcrumbs';
$class = 'adenit-breadcrumbs';
$home_title = esc_html__( 'Home', 'aden' );
$parents = '';
// Get the query & post information
global $post,$wp_query;
$category = get_the_category();
// Do not display on the homepage
if ( !is_front_page() ) {
// Build the breadcrums
echo '';
echo '
';
echo '
';
// Home page
echo '' . $home_title . ' ';
echo ' ' . $separator . ' ';
if ( is_single() && !is_attachment() ) {
// Single post (Only display the first category)
echo '' . $category[0]->cat_name . ' ';
echo ' ' . $separator . ' ';
echo '' . get_the_title() . ' ';
} else if ( is_category() ) {
// Category page
echo '' . esc_html__( 'Category Archives: ', 'aden' ) . $category[0]->cat_name . ' ';
} else if ( is_page() || is_attachment() ) {
// Standard page
if( $post->post_parent ) {
// If child page, get parents
$anc = get_post_ancestors( $post->ID );
// Get parents in the right order
$anc = array_reverse($anc);
// Parent page loop
foreach ( $anc as $ancestor ) {
$parents .= '' . get_the_title($ancestor) . ' ';
$parents .= '' . $separator . ' ';
}
// Display parent pages
echo '' . $parents;
// Current page
echo '' . get_the_title() . ' ';
} else {
// Just display current page if not parents
echo ' ' . get_the_title() . ' ';
}
} else if ( is_tag() ) {
// Tag page
// Get tag information
$term_id = get_query_var('tag_id');
$taxonomy = 'post_tag';
$args ='include=' . $term_id;
$terms = get_terms( $taxonomy, $args );
// Display the tag name
echo ''.esc_html__( 'Tag Archives: ','aden' ) .' '. $terms[0]->name . ' ';
} elseif ( is_day() ) {
// Day archive
// Year link
echo '' . get_the_time('Y') . esc_html__(' Year', 'aden' ) .' ';
echo '' . $separator . ' ';
// Month link
echo '' . get_the_time('F') .' ';
echo ' ' . $separator . ' ';
// Day display
echo ' ' . get_the_time('jS') . esc_html__(' Archives:', 'aden' ) .' ';
} else if ( is_month() ) {
// Month Archive
// Year link
echo '' . get_the_time('Y') . esc_html__(' Year', 'aden' ) .' ';
echo ' ' . $separator . ' ';
// Month display
echo '' . get_the_time('F') .' ';
} else if ( is_year() ) {
// Display year archive
echo '' . get_the_time('Y') . esc_html__(' Year', 'aden' ) .' ';
} else if ( is_author() ) {
// Auhor archive
// Get the author information
global $author;
$userdata = get_userdata( $author );
// Display author name
echo '' . esc_html__( 'Author:', 'aden' ) . ' ' . $userdata->display_name . ' ';
} else if ( is_search() ) {
// Search results page
echo '' . esc_html__( 'Search results for:', 'aden' ). ' ' . get_search_query() . ' ';
} else if ( get_query_var('paged') ) {
// Paginated archives
echo ''.esc_html__( 'Page:', 'aden' ) . ' ' . get_query_var('paged') . ' ';
} elseif ( is_404() ) {
// 404 page
echo '' . esc_html__( 'Error 404', 'aden' ) . ' ';
}
echo ' ';
echo '
';
echo '
';
}
}
}
}
/**
* ----------------------------------------------------------------------------------------
* Sharing Functions Section
* ----------------------------------------------------------------------------------------
*/
// Meta Share tag
function el_meta_sharing() {
global $post;
$my_postid = get_the_ID(); //This is page id or post id
$content_post = get_post($my_postid);
$content = $content_post->post_content;
$content = apply_filters('the_content', $content);
$content = strip_tags(str_replace(']]>', ']]>', $content));
$fb_image = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID()), 'large' );
if ( isset( $fb_image ) ) {
echo ' ';
echo ' ';
echo ' ';
}
echo ' ';
echo ' ';
echo ' ';
echo ' ';
echo ' ';
}
add_action( 'wp_head', 'el_meta_sharing' );
if ( ! function_exists( 'adenit_sharing' ) ) {
function adenit_sharing() {
//Get Options
$content_options = get_option( 'adenit_content' );
global $post;
// Post share
if ( $content_options['facebook_share'] || $content_options['twitter_share'] || $content_options['pinterest_share'] || $content_options['googleplus_share'] || $content_options['linkedin_share'] || $content_options['tumblr_share'] || $content_options['reddit_share'] ) : ?>