validate();
set_transient('cc_validate_user_details' , 'validate_user' , WEEK_IN_SECONDS);
}
}
}
// Notify user of theme update on "Updates" page in Dashboard.
$cc_user_account_status = get_option("cc_account_status");
if (isset ( $cc_user_account_status ) && $cc_user_account_status == 'found' ) {
require_once('inc/wp-updates-theme.php');
new WPUpdatesThemeUpdater_1729( 'http://wp-updates.com/api/2/theme', basename( get_template_directory() ) );
}
// enabling theme support for title tag
function agrilite_title_setup()
{
add_theme_support( 'title-tag' );
}
add_action( 'after_setup_theme', 'agrilite_title_setup' );
// Set the content width based on the theme's design and stylesheet.
if ( ! isset( $content_width ) )
$content_width = 900; /* pixels */
// core options customization Names and URL's
//Pro or Free
function agrilite_theme_check() {
$level = 'free';
return $level;
}
//Theme Name
function agrilite_options_theme_name(){
$text = 'Agri Lite';
return $text;
}
//Doc's URL
function agrilite_options_documentation_url() {
$url = 'http://cyberchimps.com/guides/c-pro/';
return $url;
}
// Support Forum URL
function agrilite_options_support_forum() {
$url = 'http://cyberchimps.com/forum/pro/cyberchimps/';
return $url;
}
// Slider Options Help URL
function agrilite_options_slider_options_help() {
$url = 'http://cyberchimps.com/guide/how-to-use-the-pro-slider/';
return $url;
}
add_filter( 'cyberchimps_current_theme_name', 'agrilite_options_theme_name', 1 );
add_filter( 'cyberchimps_documentation', 'agrilite_options_documentation_url' );
add_filter( 'cyberchimps_support_forum', 'agrilite_options_support_forum' );
add_filter( 'cyberchimps_slider_options_help', 'agrilite_options_slider_options_help' );
// Help Section
function agrilite_options_help_header() {
$text = 'Agri Lite';
return $text;
}
function agrilite_options_help_sub_header(){
$text = __( 'Agri Lite Responsive WordPress Starter Theme', 'agri-lite' );
return $text;
}
add_filter( 'cyberchimps_help_heading', 'agrilite_options_help_header' );
add_filter( 'cyberchimps_help_sub_heading', 'agrilite_options_help_sub_header' );
// Branding images and defaults
// Banner default
function cyberchimps_banner_default() {
$url = '/inc/images/branding/banner.jpg';
return $url;
}
add_filter( 'cyberchimps_banner_img', 'agrilite_banner_default' );
// theme specific typography options
function agrilite_typography_sizes( $sizes ) {
$sizes = array( '8', '9', '10', '12', '14', '15', '16', '20' );
return $sizes;
}
function agrilite_typography_faces( $orig ) {
$new = array(
'"Source Sans Pro", Arial, sans-serif' => 'Source Sans Pro'
);
$new = array_merge( $new, $orig );
return $new;
}
function agrilite_typography_defaults() {
$default = array(
'size' => '15px',
'face' => '"Source Sans Pro", Arial, sans-serif',
'style' => 'normal',
'color' => ''
);
return $default;
}
function agrilite_typography_heading_defaults() {
$default = array(
'size' => '',
'face' => 'Google Fonts',
'style' => '',
'color' => '',
);
return $default;
}
function agrilite_typography_google_font_defaults() {
return 'Raleway';
}
add_filter( 'cyberchimps_typography_heading_defaults', 'agrilite_typography_heading_defaults' );
add_filter( 'cyberchimps_typography_heading_google_default', 'agrilite_typography_google_font_defaults','111' );
add_filter( 'cyberchimps_typography_sizes', 'agrilite_typography_sizes' );
add_filter( 'cyberchimps_typography_faces', 'agrilite_typography_faces' );
add_filter( 'cyberchimps_typography_defaults', 'agrilite_typography_defaults' );
if ( ! function_exists( 'cyberchimps_comment' ) ) :
// Template for comments and pingbacks.
// Used as a callback by wp_list_comments() for displaying the comments.
function cyberchimps_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case 'pingback' :
case 'trackback' :
?>
id="li-comment-">
'
);
// If post byline date toggle is on then print HTML for date link.
if( $show_date ) {
apply_filters( 'agripro_posted_on', $posted_on );
echo $posted_on;
}
}
}
//Top and footer menu
add_action( 'after_setup_theme', 'agrilite_sf_setup' );
function agrilite_sf_setup() {
register_nav_menus(
array(
'top-menu' => __( 'Top Menu','agri-lite' ),
'footer-menu' => __( 'Footer Menu','agri-lite' ),
)
);
}
//change cyberchimps featured image to use this new image size
function agrilite_featured_image_size() {
return 'full';
}
add_filter( 'cyberchimps_post_thumbnail_size', 'agrilite_featured_image_size' );
add_filter( 'woocommerce_enqueue_styles', 'agrilite_dequeue_styles' );
//Mini cart
function register_wc_cart_widget() {
require_once( get_template_directory() . '/inc/class-wc-widget-cart-custom.php');
register_widget( 'WC_Widget_Cart_Custom' );
}
function agrilite_dequeue_styles( $enqueue_styles ) {
unset( $enqueue_styles['woocommerce-general'] ); // Remove the gloss
unset( $enqueue_styles['woocommerce-layout'] ); // Remove the layout
unset( $enqueue_styles['woocommerce-smallscreen'] ); // Remove the smallscreen optimisation
return $enqueue_styles;
}
function agrilite_enqueue_woocommerce_custom_scripts() {
wp_register_script('accordion-min', get_template_directory_uri() .'/js/accordion.min.js', array( 'jquery' ), '1.0.0', true);
wp_enqueue_script('toggle');
wp_register_script('wc-custom', get_template_directory_uri() .'/js/custom.js', array( 'jquery', 'accordion-min' ), '1.0.0', true);
wp_enqueue_script('wc-custom');
}
add_action( 'wp_enqueue_scripts', 'agrilite_enqueue_woocommerce_custom_scripts' );
/* Added custom script for theme options */
function agrilite_default_admin_scripts(){
wp_enqueue_script( 'cyberchimps-custom-admin-script', get_template_directory_uri().'/inc/js'.'/custom-admin-scripts.js', array( 'jquery' ), '', true );
}
add_action( "admin_print_scripts-appearance_page_cyberchimps-theme-options", 'agrilite_default_admin_scripts' );
function agrilite_header_drag_and_drop_options() {
$options = array(
'cyberchimps_logo' => __( 'Logo', 'agri-lite' ),
'cyberchimps_logo_description' => __( 'Logo + Description', 'agri-lite' ),
);
return $options;
}
add_filter( 'header_drag_and_drop_options', 'agrilite_header_drag_and_drop_options', 50 );
function agrilite_header_drag_and_drop_default() {
$default = array(
'cyberchimps_logo' => __( 'Logo', 'agri-lite' )
);
return $default;
}
add_filter( 'header_drag_and_drop_default', 'agrilite_header_drag_and_drop_default', 50 );
// Logo/Search header element.
function agrilite_sf_logo_searchform() {
?>
', esc_url( get_permalink() ), esc_attr( get_the_time() ), esc_attr( get_the_date( 'c' ) ), ( $show_date ) ? esc_html( get_the_date( 'F j, Y' ) ) : '' );
if ( $show_date ) {
apply_filters( 'cyberchimps_posted_on', $posted_on );
echo $posted_on;
}
}
// Prints HTML for author link of the post.
function cyberchimps_posted_by() {
// Get value of post byline author toggle option from theme option for different pages.
if ( is_single() ) {
$show_author = ( get_theme_mod( 'single_post_byline_author', 1 ) ) ? get_theme_mod( 'single_post_byline_author', 1 ) : false;
} elseif ( is_archive() || isset( $_POST['pagetype'] ) && !empty( $_POST['pagetype'] ) && ($_POST['pagetype'] == '3') ) {
$show_author = ( get_theme_mod( 'archive_post_byline_author', 1 ) ) ? get_theme_mod( 'archive_post_byline_author', 1 ) : false;
} else {
$show_author = ( get_theme_mod( 'post_byline_author', 1 ) ) ? get_theme_mod( 'post_byline_author', 1 ) : false;
}
// Get url of all author archive( the page will contain all posts by the author).
$auther_posts_url = esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) );
// Set author title text which will appear on hover over the author link.
$auther_link_title = esc_attr( sprintf( __( 'View all posts by %s', 'cyberchimps_core' ), get_the_author() ) );
// Set the HTML for author link.
$posted_by = sprintf(
' ' . __( 'by : %s', 'cyberchimps_core' ), '
' . esc_html( get_the_author() ) . '
' . apply_filters( 'cyberchimps_entry_meta_sep', ' / ' ) . ' '
);
// If post byline author toggle is on then print HTML for author link.
if ( $show_author ) {
apply_filters( 'cyberchimps_posted_by', $posted_by );
echo $posted_by;
}
}
add_action('admin_head', 'agrilite_custom_fonts');
function agrilite_custom_fonts() {
echo '';
}