' . cyberchimps_get_option( 'search_post_read_more' ) . '
'; return $more; } else { $more = '' . __( 'Read More...', 'cyberchimps_core' ) . '
'; return $more; } } // excerpt length for search results function cyberchimps_search_excerpt_length( $length ) { global $post; if( cyberchimps_get_option( 'search_post_excerpt_length' ) != '' ) { $length = cyberchimps_get_option( 'search_post_excerpt_length' ); return $length; } else { $length = 55; return $length; } } //For archive posts function cyberchimps_archive_excerpt_more( $more ) { global $post; return '' . cyberchimps_blog_read_more_text() . '
'; } if( cyberchimps_get_option( 'archive_post_excerpts', 0 ) != 0 ) { add_filter( 'excerpt_more', 'cyberchimps_blog_excerpt_more', 999 ); } // Set value for blog read more text option. function cyberchimps_blog_read_more_text() { // Get the value of blog read more text option. $read_more = cyberchimps_get_option( 'blog_read_more_text' ); // Check whether any not null value supplied and set the value accordingly. if( '' != $read_more ) { return $read_more; } else { return __( 'Read More...', 'cyberchimps_core' ); } } //For blog posts function cyberchimps_blog_excerpt_more( $more ) { global $post; return '' . cyberchimps_blog_read_more_text() . '
'; } if( cyberchimps_get_option( 'post_excerpts', 0 ) != 0 ) { add_filter( 'excerpt_more', 'cyberchimps_blog_excerpt_more', 10 ); } /** * Set custom post excerpt link if excerpt is supplied manually. */ function manual_excerpt_read_more_link( $output ) { global $post; $linktext = cyberchimps_blog_read_more_text(); if( !empty( $post->post_excerpt ) ) { return $output . ''; } else { return $output; } } add_filter( 'the_excerpt', 'manual_excerpt_read_more_link' ); function cyberchimps_blog_excerpt_length( $length ) { global $post; if( cyberchimps_get_option( 'blog_excerpt_length' ) != '' ) { $length = cyberchimps_get_option( 'blog_excerpt_length' ); return $length; } else { $length = 55; return $length; } } if( cyberchimps_get_option( 'post_excerpts', 0 ) != 0 ) { add_filter( 'excerpt_length', 'cyberchimps_blog_excerpt_length', 999 ); } /* gets post views */ function cyberchimps_getPostViews( $postID ) { $count_key = 'post_views_count'; $count = get_post_meta( $postID, $count_key, true ); if( $count == '' ) { delete_post_meta( $postID, $count_key ); add_post_meta( $postID, $count_key, '0' ); return "0 View"; } return $count . ' Views'; } /* Sets post views */ function cyberchimps_setPostViews( $postID ) { $count_key = 'post_views_count'; $count = get_post_meta( $postID, $count_key, true ); if( $count == '' ) { $count = 0; delete_post_meta( $postID, $count_key ); add_post_meta( $postID, $count_key, '0' ); } else { $count++; update_post_meta( $postID, $count_key, $count ); } } /* To correct issue: adjacent_posts_rel_link_wp_head causes meta to be updated multiple times */ remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 ); // Set up half slide for iFeature pro slider, adds it before post/page content function cyberchimps_half_slider() { global $post; if( is_page() ) { $page_section_order = get_post_meta( $post->ID, 'cyberchimps_page_section_order', true ); //if page_section_order is empty sets page as default $page_section_order = ( $page_section_order == '' ) ? array( 'page_section' ) : $page_section_order; if( in_array( 'page_slider', $page_section_order, true ) ) { $slider_size = get_post_meta( $post->ID, 'cyberchimps_slider_size', true ); if( $slider_size == 'half' ) { do_action( 'page_slider' ); } } } else { $blog_section_order = cyberchimps_get_option( 'blog_section_order' ); //select default in case options are empty $blog_section_order = ( $blog_section_order == '' ) ? array( 'blog_post_page' ) : $blog_section_order; if( in_array( 'page_slider', $blog_section_order, true ) ) { $slider_size = cyberchimps_get_option( 'blog_slider_size' ); if( $slider_size == 'half' ) { do_action( 'page_slider' ); } } } } // Hook action to after/before content hook depending upon slider order. function cyberchimps_add_half_slider_action( $slider_order ) { add_action( 'cyberchimps_' . $slider_order . '_content', 'cyberchimps_half_slider' ); } // Help text function cyberchimps_options_help_text() { $text = ''; $instruction_img = get_template_directory_uri() . '/cyberchimps/options/lib/images/document.png'; $support_img = get_template_directory_uri() . '/cyberchimps/options/lib/images/questionsupport.png'; $text .= '' . __( 'If you want even more amazing new features upgrade to %1$s which includes a Custom Features Slider, Image Carousel, Widgetized Boxes, Callout Section, expanded typography including Google Fonts, more color skins, and many more powerful new features. Please visit %2$s to learn more!', 'cyberchimps_core' ) . '
', '' . $pro_title . '', 'CyberChimps.com' ); } //text for pro themes else { $text .= ''; } return $text; } add_filter( 'cyberchimps_help_description', 'cyberchimps_options_help_text' ); // upgrade bar for free themes function cyberchimps_upgrade_bar() { $current_theme_name = apply_filters( 'cyberchimps_current_theme_name', 'CyberChimps' ); $upgrade_link = apply_filters( 'cyberchimps_upgrade_link', 'http://cyberchimps.com' ); $pro_title = apply_filters( 'cyberchimps_upgrade_pro_title', 'CyberChimps Pro' ); ?>
' . $pro_title . ' '
); ?>
';
$icon_neg = '
';
$installed_plugins = get_plugins();
if( isset( $installed_plugins[$plugin] ) ) {
if( is_plugin_active( $plugin ) ) {
$output .= $icon . '' . __( 'Events Plugin Options', 'cyberchimps_core' ) . '';
}
else {
$output .= $icon_neg . '' . __( 'Please activate The Events Calendar plugin', 'cyberchimps_core' ) . '';
}
}
else {
$output .= $icon_neg . '' . __( 'Install Events Calendar Plugin', 'cyberchimps_core' ) . '';
}
echo $output;
}
// return a nonced installation link for the plugin.
function cyberchimps_eventcal_install_link() {
include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
$slug = 'the-events-calendar';
return wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $slug ), 'install-plugin_' . $slug );
}
// Digital Downloads Text
function cyberchimps_digital_downloads_callback( $value ) {
$output = '';
$plugin = 'easy-digital-downloads/easy-digital-downloads.php';
$icon = '
';
$icon_neg = '
';
$installed_plugins = get_plugins();
if( isset( $installed_plugins[$plugin] ) ) {
if( is_plugin_active( $plugin ) ) {
$output .= $icon . '' . __( 'Digital Downloads Settings', 'cyberchimps_core' ) . '';
}
else {
$output .= $icon_neg . '' . __( 'Please activate Easy Digital Downloads plugin', 'cyberchimps_core' ) . '';
}
}
else {
$output .= $icon_neg . '' . __( 'Install Easy Digital Downloads Plugin', 'cyberchimps_core' ) . '';
}
echo $output;
}
// return a nonced installation link for the plugin.
function cyberchimps_digital_downloads_install_link() {
include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
$slug = 'easy-digital-downloads';
return wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $slug ), 'install-plugin_' . $slug );
}
// Add class cc-responsive if responisve design is on.
add_filter( 'body_class', 'cyberchimps_add_responsive_class' );
function cyberchimps_add_responsive_class( $classes ) {
// Check if responisve design is on.
if( cyberchimps_get_option( 'responsive_design', 'checked' ) ) {
$classes[] = 'cc-responsive';
}
return $classes;
}
if ( 'mp6' === get_user_option( 'admin_color' ) || version_compare( $GLOBALS['wp_version'], '3.8-alpha', '>' ) ) {
function load_custom_admin_styles() {
wp_enqueue_style( 'cc-admin', get_template_directory_uri() . '/cyberchimps/options/lib/css/custom-post-icons.css', false, '1.0.0' );
}
add_action( 'admin_enqueue_scripts', 'load_custom_admin_styles' );
}