File: /home/harmonyg/www/ektest/wp-content/themes/hathor/functions.php
<?php
/**
* Hathor functions and definitions
*
* For more information on hooks, actions, and filters, @link http://codex.wordpress.org/Plugin_API
*/
/*
* Set up the content width value based on the theme's design.
*
*/
if ( ! isset( $content_width ) )
$content_width = 630;
//Load Other CSS files
function hathor_other_css() {
if ( !is_admin() ) {
wp_enqueue_style( 'hathor_other', get_template_directory_uri() . '/css/foundation.css' );
wp_enqueue_style( 'hathor_other', get_template_directory_uri() . '/css/nivo-slider.css' );
wp_enqueue_style( 'sidr_dark', get_template_directory_uri() . '/css/jquery.sidr.dark.css' );
wp_enqueue_style( 'hathor-style', get_stylesheet_uri() );
} }
add_action('wp_enqueue_scripts', 'hathor_other_css');
function hathor_other1_css() {
if ( !is_admin() ) {
wp_enqueue_style( 'hathor_other1', get_template_directory_uri() . '/css/nivo-slider.css' );
} }
add_action('wp_enqueue_scripts', 'hathor_other1_css');
function hathor_other2_css() {
if ( !is_admin() ) {
wp_enqueue_style( 'hathor_other2', get_template_directory_uri() . '/fonts/awesome/css/font-awesome.min.css' );
} }
add_action('wp_enqueue_scripts', 'hathor_other2_css');
function hathor_fonts_css() {
if ( !is_admin(
) ) {
{ ?>
<?php wp_enqueue_style('customfont',get_template_directory_uri().'/fonts/'.$os_fonts = of_get_option('font_select', 'raleway' ).'.css'); }
}
}
add_action('wp_enqueue_scripts', 'hathor_fonts_css');
//Load Custom CSS
function hathor_customstyle() { ?>
<?php if(of_get_option('sldrtxt_checkbox') == "0"){ ?>
<style type="text/css">
body .nivo-caption {
display: none!important;
}
</style>
<?php } ?>
<?php if(of_get_option('sldrtitle_checkbox') == "0"){ ?>
<style type="text/css">
.nivo-caption h3 {
display: none!important;
}
</style>
<?php } ?>
<?php if(of_get_option('sldrdes_checkbox') == "0"){ ?>
<style type="text/css">
.nivo-caption p {
display: none!important;
}
</style>
<?php } ?>
<style type="text/css">
/*Secondary Elements Color*/
.postitle, .postitle a,.postitle2 a, .widgettitle,.widget-title, .entry-title a, .widgettitle2, #reply-title, #comments span, .catag_list a, .lay2 h2, .nivo-caption a, .nivo-caption,.entry-title,.content_blog .post_title a,.title h2.blue1,.title h2.green1 ,.postitle_lay a,#wp-calendar tr td a,.vcard a,.post_content a:link,.post_content p a,.comments_template,.post_info_wrap a{
color:<?php echo of_get_option('flavour_colorpicker');
?>!important;
}
.midrow_block,.style2.icon_img,.icon_img {border-color:<?php echo of_get_option('flavour_colorpicker');
?>!important;}
.midbutton,.nivo-controlNav a.active,#sub_banner,#wp-calendar #today,#searchsubmit,#content .more-link,#submit,.nivo-caption h3,.post_info_1 .post_date,#navmenu ul > li::after,.scrollup,.midbutton2{
background-color:<?php echo of_get_option('flavour_colorpicker');
?>!important;
}
.view a.info:hover,#navmenu ul > li ul li:hover,#submit:hover,.midbutton:hover,#searchsubmit:hover ,.midbutton2:hover {
background-color:<?php echo of_get_option('hover_colorpicker');
?>!important; background:<?php echo of_get_option('hover_colorpicker');?>!important;
}
.ch-info a:hover,.widget_tag_cloud a:hover,.post_info a:hover,.post_views a:hover,
.post_comments a:hover,.wp-pagenavi:hover, .alignleft a:hover, .wp-pagenavi:hover ,.alignright a:hover,.comment-form a:hover,.port a:hover,.previous a:hover, .next a:hover,.our_team p.port_team a:hover{
color:<?php echo of_get_option('hover_colorpicker');
?>!important;}
</style>
<?php }
add_action( 'wp_head', 'hathor_customstyle' );
//Load Java Scripts to header
function hathor_head_js() {
if ( !is_admin() ) {
wp_enqueue_script('jquery');
wp_enqueue_script('hathor_js',get_template_directory_uri().'/other2.js');
wp_enqueue_script('hathor_other',get_template_directory_uri().'/js/other.js');
wp_enqueue_script('jquery_sidr',get_template_directory_uri().'/js/jquery.sidr.js');
if(of_get_option('slider_select') == "nivo"){ wp_enqueue_script('hathor_nivo',get_template_directory_uri().'/js/jquery.nivo.js');}
if(of_get_option('disslight_checkbox') == "0")
if ( is_singular() ) wp_enqueue_script( 'comment-reply' );
}
}
add_action('wp_enqueue_scripts', 'hathor_head_js');
//Load Java Scripts to Footer
add_action('wp_footer', 'hathor_load_js');
function hathor_load_js() { ?>
<?php if(of_get_option('slider_select') == "nivo"){ ?>
<script type="text/javascript">
jQuery(window).load(function() {
// nivoslider init
jQuery('#nivo') .nivoSlider({
effect: 'random',
animSpeed:700,
pauseTime:<?php echo of_get_option('sliderspeed_text'); ?>,
startSlide:0,
slices:10,
directionNav:true,
directionNavHide:true,
controlNav:true,
controlNavThumbs:false,
keyboardNav:true,
pauseOnHover:true,
captionOpacity:0.8,
afterLoad: function(){
if (jQuery(window).width() < 480) {
jQuery(".nivo-caption ").animate({"opacity": "1", "right":"0"}, {easing:"easeOutBack", duration: 500});
}else{
jQuery(".nivo-caption").animate({"opacity": "1", "bottom":"15%"}, {easing:"easeOutBack", duration: 500});
jQuery(".nivo-caption ").has('.sld_layout3').addClass('sld3wrap');
}
},
beforeChange: function(){
jQuery(".nivo-caption ").animate({bottom:"-500px"}, {easing:"easeInBack", duration: 500});
//jQuery(".nivo-caption").delay(400).removeClass('sld3wrap');
jQuery('.nivo-caption ').animate({"opacity": "0"}, 100);
jQuery('.nivo-caption ').delay(500).queue(function(next){
jQuery(this).removeClass("sld3wrap");next();});
},
afterChange: function(){
if (jQuery(window).width() < 480) {
jQuery(".nivo-caption ").animate({"opacity": "1", "bottom":"0"}, {easing:"easeOutBack", duration: 500});
}else{
jQuery(".nivo-caption ").animate({"opacity": "1", "bottom":"15%"}, {easing:"easeOutBack", duration: 500});
jQuery(".nivo-caption ").has('.sld_layout3').addClass('sld3wrap');
}
}
});
});
</script>
<?php } ?>
<script type="text/javascript" charset="utf-8">
jQuery(window).ready(function($) {
/* Side responsive menu */
$('.menu-toggle').sidr({
name: 'sidr-left',
side: 'left',
source: '#navmenu',
onOpen: function() {
$('.menu-toggle').animate({
marginLeft: "260px"
}, 200);
},
onClose: function() {
$('.menu-toggle').animate({
marginLeft: "0px"
}, 200);
}
});
});
jQuery(document).ready(function($) {
jQuery('#work-carousel' ).carouFredSel({
next : "#work-carousel-next",
prev : "#work-carousel-prev",
auto: false,
circular: false,
infinite: true,
width: '100%',
scroll: {
items : 1
}
});
});
jQuery(document).ready(function($) {
jQuery('#work-carousel3' ).carouFredSel({
next : "#work-carousel-next3",
prev : "#work-carousel-prev3",
auto: false,
circular: false,
infinite: true,
width: '100%',
scroll: {
items : 1
}
});
});
jQuery(document).ready(function($) {
jQuery('#work-carousels' ).carouFredSel({
next : "#work-carousel-next2",
prev : "#work-carousel-prev2",
auto: false,
circular: false,
infinite: true,
width: '100%',
scroll: {
items : 1
}
});
});
</script>
<?php }
/* hathor welcome text */
//hathor get the first image of the post Function
function hathor_get_images($overrides = '', $exclude_thumbnail = false)
{
return get_posts(wp_parse_args($overrides, array(
'numberposts' => -1,
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'post_mime_type' => 'image',
'order' => 'ASC',
'exclude' => $exclude_thumbnail ? array(get_post_thumbnail_id()) : array(),
'orderby' => 'menu_order ID'
)));
}
//ADD FULL WIDTH BODY CLASS
add_filter( 'body_class', 'hathor_fullwdth_body_class');
function hathor_fullwdth_body_class( $classes ) {
if(of_get_option('nosidebar_checkbox') == "1")
$classes[] = 'hathor_fullwdth_body';
return $classes;
}
//Custom Excerpt Length
function hathor_excerptlength_teaser($length) {
return 30;
}
function hathor_excerptlength_index($length) {
return 12;
}
function hathor_excerptmore($more) {
return '...';
}
function hathor_excerpt($length_callback='', $more_callback='') {
global $post;
if(function_exists($length_callback)){
add_filter('excerpt_length', $length_callback);
}
if(function_exists($more_callback)){
add_filter('excerpt_more', $more_callback);
}
$output = get_the_excerpt();
$output = apply_filters('wptexturize', $output);
$output = apply_filters('convert_chars', $output);
$output = '<p>'.$output.'</p>';
echo $output;
}
/*-----------------------------------------------------------------------------------*/
/* Display <title> tag
/*-----------------------------------------------------------------------------------*/
add_action( 'after_setup_theme', 'theme_slug_setup' );
function theme_slug_setup() {
add_theme_support( 'title-tag' );
}
//SIDEBAR
function hathor_widgets_init(){
register_sidebar(array(
'name' => __('Right Sidebar', 'hathor'),
'id' => 'sidebar',
'description' => __('Right Sidebar', 'hathor'),
'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget_wrap">',
'after_widget' => '</div></div>',
'before_title' => '<h3 class="widgettitle">',
'after_title' => '</h3>'
));
register_sidebar(array(
'name' => __('Footer Widgets', 'hathor'),
'id' => 'foot_sidebar',
'description' => __('Widget Area for the Footer', 'hathor'),
'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget_wrap">',
'after_widget' => '</div></div>',
'before_title' => '<h3 class="widgettitle">',
'after_title' => '</h3>'
));
}
add_action( 'widgets_init', 'hathor_widgets_init' );
//**************hathor SETUP******************//
function hathor_setup() {
//Custom Background
add_theme_support( 'custom-background', array(
'default-color' => 'FFF',
) );
add_theme_support('automatic-feed-links');
//Post Thumbnail
add_theme_support( 'post-thumbnails' );
//Register Menus
register_nav_menus( array(
'primary' => __( 'Primary Navigation(Header)', 'hathor' ),
) );
// Enables post and comment RSS feed links to head
add_theme_support('automatic-feed-links');
/*
* Enable support for custom logo.
*
* @since hathor
*/
$defaults = array(
'height' => 80,
'width' => 180,
'flex-width' => true,
'header-text' => array( 'site-title', 'site-description' ),
);
add_theme_support('custom-logo', $defaults);
/*
* Loads the Options Panel
*
* If you're loading from a child theme use stylesheet_directory
* instead of template_directory
*/
define( 'OPTIONS_FRAMEWORK_DIRECTORY', get_template_directory_uri() . '/admin/' );
require_once dirname( __FILE__ ) . '/admin/options-framework.php';
}
add_action( 'after_setup_theme', 'hathor_setup' );
/**
* The CORE functions for newspapers
*
* Stores all the core functions of the template.
*
* @package newspapers
*
* @since newspapers 1.0
*/
if (! function_exists('hathor_the_custom_logo')) :
/**
* Displays the optional custom logo.
*
* Does nothing if the custom logo is not available.
*
* @since hathor
*/
function hathor_the_custom_logo()
{
if (function_exists('the_custom_logo')) {
the_custom_logo();
}
}
endif;
?>
<?php