__('Header top menu', 'cc'), 'primary' => __('Header bottom menu', 'cc'), )); // This theme allows users to set a custom background if ($cap->add_custom_background == true) { add_theme_support('custom-background'); } // Your changeable header business starts here define('HEADER_TEXTCOLOR', '888888'); // No CSS, just an IMG call. The %s is a placeholder for the theme template directory URI. define('HEADER_IMAGE', '%s/images/default-header.png'); // The height and width of your custom header. You can hook into the theme's own filters to change these values. // Add a filter to cc_header_image_width and cc_header_image_height to change these values. define('HEADER_IMAGE_WIDTH', apply_filters('cc_header_image_width', 1000)); define('HEADER_IMAGE_HEIGHT', apply_filters('cc_header_image_height', 233)); // Add a way for the custom header to be styled in the admin panel that controls // custom headers. See cc_admin_header_style(), below. if ($cap->add_custom_image_header == true) { $defaults = array( /* 'default-image' => '', 'random-default' => false, 'width' => 0, 'height' => 0, 'flex-height' => false, 'flex-width' => false, 'default-text-color' => '', 'header-text' => true, 'uploads' => true, */ // 'wp-head-callback' => 'cc_admin_header_style', // 'admin-head-callback' => 'cc_header_style', 'admin-preview-callback' => 'cc_admin_header_image', ); add_theme_support('custom-header', $defaults); //add_custom_image_header( 'cc_header_style', 'cc_admin_header_style', 'cc_admin_header_image' ); } // Define Content with $content_width = "670"; if ($cap->sidebar_position == "left and right") { $content_width = "432"; } // Define disable the admin bar if ($cap->bp_login_bar_top == 'off' || $cap->bp_login_bar_top == __('off', 'cc')) { define('BP_DISABLE_ADMIN_BAR', true); } } endif; if (!function_exists('cc_admin_header_image')) : /** * Custom header image markup displayed on the Appearance > Header admin panel. * * Referenced via add_custom_image_header() in cc_setup(). * */ function cc_admin_header_image() { ?>

onclick="return false;" href="">

>
'sidebar right', 'id' => 'sidebar', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebars(1, array( 'name' => 'sidebar left', 'id' => 'leftsidebar', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); ### Add Sidebars register_sidebars(1, array( 'name' => 'header full width', 'id' => 'headerfullwidth', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebars(1, array( 'name' => 'header left', 'id' => 'headerleft', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebars(1, array( 'name' => 'header center', 'id' => 'headercenter', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebars(1, array( 'name' => 'header right', 'id' => 'headerright', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebars(1, array( 'name' => 'footer full width', 'id' => 'footerfullwidth', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebars(1, array( 'name' => 'footer left', 'id' => 'footerleft', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebars(1, array( 'name' => 'footer center', 'id' => 'footercenter', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebars(1, array( 'name' => 'footer right', 'id' => 'footerright', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebars(1, array( 'name' => 'member header', 'id' => 'memberheader', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebars(1, array( 'name' => 'member header left', 'id' => 'memberheaderleft', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebars(1, array( 'name' => 'member header center', 'id' => 'memberheadercenter', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebars(1, array( 'name' => 'member header right', 'id' => 'memberheaderright', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebars(1, array( 'name' => 'member sidebar left', 'id' => 'membersidebarleft', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebars(1, array( 'name' => 'member sidebar right', 'id' => 'membersidebarright', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebars(1, array( 'name' => 'group header', 'id' => 'groupheader', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebars(1, array( 'name' => 'group header left', 'id' => 'groupheaderleft', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebars(1, array( 'name' => 'group header center', 'id' => 'groupheadercenter', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebars(1, array( 'name' => 'group header right', 'id' => 'groupheaderright', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebars(1, array( 'name' => 'group sidebar left', 'id' => 'groupsidebarleft', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebars(1, array( 'name' => 'group sidebar right', 'id' => 'groupsidebarright', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); } if ($cap->buddydev_search == true && defined('BP_VERSION') && function_exists('bp_is_active')) { //* Add these code to your functions.php to allow Single Search page for all buddypress components*/ // Remove Buddypress search drowpdown for selecting members etc add_filter("bp_search_form_type_select", "cc_remove_search_dropdown"); function cc_remove_search_dropdown($select_html) { return ''; } remove_action('init', 'bp_core_action_search_site', 5); //force buddypress to not process the search/redirect add_action('init', 'cc_bp_buddydev_search', 10); // custom handler for the search function cc_bp_buddydev_search() { global $bp; if ($bp->current_component == BP_SEARCH_SLUG)//if thids is search page bp_core_load_template(apply_filters('bp_core_template_search_template', 'search-single')); //load the single searh template } add_action("advance-search", "cc_show_search_results", 1); //highest priority /* we just need to filter the query and change search_term=The search text */ function cc_show_search_results() { //filter the ajaxquerystring add_filter("bp_ajax_querystring", "cc_global_search_qs", 100, 2); } //show the search results for member*/ function cc_show_member_search() { ?>

total_member_count > 1 && !empty($search_terms)):?> total_member_count); ?>

current_component == BP_SEARCH_SLUG) return true; return false; } remove_action('bp_init', 'bp_core_action_search_site', 7); } //load current displaymode template - loop-list.php or loop-grid.php function cc_get_displaymode($object) { $_BP_COOKIE = &$_COOKIE; if (isset($_BP_COOKIE['bp-' . $object . '-displaymode'])) { get_template_part("{$object}/{$object}-loop", $_BP_COOKIE['bp-' . $object . '-displaymode']); } else { get_template_part("{$object}/{$object}-loop", 'list'); } } //check if displaymode grid function cc_is_displaymode_grid($object) { $_BP_COOKIE = &$_COOKIE; return ( isset($_BP_COOKIE['bp-' . $object . '-displaymode']) && $_BP_COOKIE['bp-' . $object . '-displaymode'] == 'grid'); } /** * Get pro version */ function cc_get_pro_version() { $pro_enabler = get_template_directory() . DIRECTORY_SEPARATOR . '_pro' . DIRECTORY_SEPARATOR . 'pro-enabler.php'; if (file_exists($pro_enabler)) { require_once $pro_enabler; } } /** * Fix ...[] */ function cc_replace_read_more($text) { return '
' . __('...read more', 'cc') . '
'; } add_filter('excerpt_more', 'cc_replace_read_more'); /** * Display the rate for us message */ function cc_add_rate_us_notice() { $hide_message = get_option('cc_hide_activation_message', false); if (!$hide_message) { echo '
' . cc_get_add_rate_us_message() . '' . __('Dismiss', 'cc') . '
'; } } function cc_get_add_rate_us_message() { return 'Please rate for Custom Community theme on WordPress.org'; } /** * Ajax processor for show/hide Please rate for */ add_action('wp_ajax_dismiss_activation_message', 'cc_dismiss_activation_message'); function cc_dismiss_activation_message() { echo update_option('cc_hide_activation_message', $_POST['value']); die(); } /** * Ajax processor for show/hide Please info for */ add_action('wp_ajax_cc_dismiss_info_messages', 'cc_dismiss_info_messages'); function cc_dismiss_info_messages() { echo update_option($_POST['action'], $_POST['value']); die(); } /** * Add css */ function cc_add_styles() { global $cap; if ($cap->cc_responsive_enable) { wp_enqueue_style('bootstrap', get_template_directory_uri() . '/_inc/css/bootstrap-responsive.css'); wp_enqueue_style('custom', get_template_directory_uri() . '/_inc/css/custom-responsive.css'); } } add_action('wp_head', 'cc_add_styles', 10); /** * Add class span%2 for menu items * @param string $items * @param array $args * @return string items with new class */ function cc_add_spanclass($items, $args) { $items = explode('', $items); $newitems = array(); // loop through the menu items, and add the new link at the right position foreach ($items as $item) { $newitems[] = str_replace('class="', 'class="span2 ', $item); } // finally put all the menu items back together into a string using the ending
  • tag and return $newitems = implode('
  • ', $newitems); return $newitems; } //add_filter('wp_list_pages', 'cc_add_spanclass', 10, 2); //add_filter('wp_nav_menu_items', 'cc_add_spanclass', 10, 2); /** * Slider functions, used in slideshow parts * @global object $post post object * @global type $cc_js * @global type $cap * @global type $post * @param type $atts * @param type $content * @return type */ function cc_slider($atts, $content = null) { global $post, $cc_js, $cap; extract(shortcode_atts(array( 'amount' => '4', 'category__in' => array(), 'category_name' => '', 'page_id' => '', 'post_type' => 'post', 'orderby' => 'DESC', 'slider_nav' => 'on', 'caption' => 'on', 'caption_height' => '', 'caption_top' => '', 'caption_width' => '', 'reflect' => '', 'width' => '', 'height' => '', 'id' => '', 'background' => '', 'slider_nav_color' => '', 'slider_nav_hover_color' => '', 'slider_nav_selected_color' => '', 'slider_nav_font_color' => '', 'time_in_ms' => '5000', 'allow_direct_link' => __('no', 'cc'), 'open_new_tab' => __('no', 'cc'), ), $atts)); if ($page_id != '' && $post_type == 'post') { $post_type = array('page', 'post'); } //pages haven't categories if (!empty($page_id)){ $category_name = ''; $category__in = array(); } if ($page_id != '') { $page_id = explode(',', $page_id); } $tmp = chr(13); $tmp .= '' . chr(13); $args = array( 'orderby' => $orderby, 'post_type' => $post_type, 'post__in' => $page_id, 'category__in' => $category__in, 'category_name' => $category_name, 'posts_per_page' => $amount ); remove_all_filters('posts_orderby'); query_posts($args); if (have_posts()) { $shortcodeclass = ''; if ($id == "top") $shortcodeclass = "cc_slider_shortcode"; $tmp .='
    ' . chr(13); $tmp .='
    ' . chr(13); } else { $tmp .='
    ' . chr(13); $tmp .='
    ' . chr(13); } wp_reset_query(); // js vars $cc_js['slideshow'][] = array( 'id' => $id, 'time_in_ms' => $time_in_ms ); return $tmp . chr(13); } /** * Get class by sidebar position settings in Themes Options */ function cc_get_class_by_sidebar_position() { global $cap, $post; if(empty($post)){ return FALSE; } $class = ''; $tmp = get_post_meta($post->ID, '_wp_page_template', true); switch ($cap->sidebar_position) { case "left and right": $class = 'left-right-sidebar'; break; case 'full-width' : $class = 'full-width'; break; }; switch ($tmp) { case '_pro/tpl-search-right-and-left-sidebar.php': $class .= ' left-right-template'; break; case 'tpl-search-full-width.php': $class .= ' full-search-width'; break; } switch ($cap->archive_template) { case __("left and right", 'cc'): $class .= ' archive-width'; } return $class; } /** * Add info before tabs in Theme Options */ function cc_add_settins_info($tab_id) { if ('cap_slideshow' == $tab_id) { $show = get_option('cc_dismiss_info_messages', FALSE); if (empty($show)) { _e('

    Slideshow settings of the single pages are stronger and will overwrite the global slideshow settings

    ', CC_TRANSLATE_DOMAIN); } } } add_action('cc_before_settings_tab', 'cc_add_settins_info'); /** * Add rotate function to jquery iu 1.9 */ function cc_add_rotate_tabs() { global $cap; wp_enqueue_script('cc_rotate', get_template_directory_uri() . '/_inc/js/jquery-ui-tabs-rotate.js', array('jquery', 'jquery-ui-tabs')); wp_enqueue_script( 'dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array( 'jquery' ) ); wp_localize_script('dtheme-ajax-js', 'cc_settings', array( 'open_new_tab' => $cap->open_new_tab )); } add_action('wp_enqueue_scripts', 'cc_add_rotate_tabs'); /** * Enqueue theme javascript safely for admin console * * @see http://codex.wordpress.org/Function_Reference/wp_enqueue_script * @since 1.9.1 */ function admin_dtheme_enqueue_scripts() { global $cap; $cap = new autoconfig(); //add for imadiatly view settings after save options $responsive = !empty($_POST) && !empty($_POST['custom_community_theme_options']) ? $_POST['custom_community_theme_options']['cap_cc_responsive_enable'] == __('Enabled', 'cc') ? 1 : 0 : $cap->cc_responsive_enable; // Enqueue the global JS - Ajax will not work without it wp_register_script('autogrow-textarea', get_template_directory_uri() . "/admin/js/jquery.autogrow-textarea.js", array(), true); wp_enqueue_script('cc-theme-admin-js', get_template_directory_uri() . '/_inc/js/admin.js', array('jquery', 'autogrow-textarea')); wp_localize_script('cc-theme-admin-js', 'admin_params', array( 'ajax_url' => site_url('/wp-admin/admin-ajax.php'), 'blog' => __('blog', 'cc'), 'flux_slider' => __('flux slider', 'cc'), 'default_slider' => __('default', 'cc'), 'responsive' => $responsive ) ); } add_action('admin_enqueue_scripts', 'admin_dtheme_enqueue_scripts'); /** * WooCommerce 2.0+ Support * since version 1.15 */ remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10); remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10); add_action('woocommerce_before_main_content', 'cc_wc_wrapper_start', 10); add_action('woocommerce_after_main_content', 'cc_wc_wrapper_end', 10); function cc_wc_wrapper_start() { echo '
    '; } function cc_wc_wrapper_end() { echo '
    '; } add_theme_support( 'woocommerce' ); /** * Edit readmore links urls * @param string $link * @return string $link without */ function cc_remove_more_link_scroll( $link ) { $link = preg_replace( '|#more-[0-9]+|', '', $link ); return $link; } add_filter( 'the_content_more_link', 'cc_remove_more_link_scroll' ); function get_posts_titles($title, $post_id){ global $cap, $post; if(empty($cap->titles_post_types) || in_array($post->post_type, $cap->titles_post_types)){ $is_title_hidden = get_post_meta($post_id, '_cc_hide_title', TRUE); if($is_title_hidden == 'yes'){ return FALSE; } $center_title = get_post_meta($post_id, '_cc_center_title', TRUE); ?>

    ID )) { $thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'medium' ); echo '' . chr(13); } } add_action( 'wp_head', 'insert_image_src_rel_in_head', 5 ); /** * Get body class for responsive/not responsive * @global object $cap * @return string body class */ function get_responcive_class(){ global $cap; if($cap->cc_responsive_enable){ return 'responsive'; } else { return 'not-responsive'; } } /** * Add styles to front end wp editor * @global type $editor_styles */ function cc_add_editor_styles() { $stylesheet = '_inc/css/editor-style.css'; add_theme_support( 'editor-style' ); global $editor_styles; $editor_styles = (array) $editor_styles; $stylesheet = (array) $stylesheet; if ( is_rtl() ) { $rtl_stylesheet = str_replace('.css', '-rtl.css', $stylesheet[0]); $stylesheet[] = $rtl_stylesheet; } $editor_styles = array_merge( $editor_styles, $stylesheet ); } add_action( 'init', 'cc_add_editor_styles' ); /** * Add scripts to admin part */ function cc_add_admin_editor_styles(){ add_editor_style('_inc/css/editor-styles.php'); wp_enqueue_style('admin_post_wodth', get_template_directory_uri() .'/_inc/css/width-calculators.php'); } add_action('init', 'cc_add_admin_editor_styles', 100); add_filter( 'wp_nav_menu_items', 'add_home_link', 10, 2 ); function add_home_link($items, $args) { global $cap; $community_item = $homeMenuItem = ''; if($cap->menue_disable_home == true){ ob_start(); ?> menue_enable_community == true){ ob_start(); ?> ='): return ($key >= __($value, 'cc') || $key >= $value); case ('<='): return ($key <= __($value, 'cc') || $key <= $value); case ('<'): return ($key < __($value, 'cc') || $key < $value); case ('>'): return ($key > __($value, 'cc') || $key > $value); case ('==='): return ($key === __($value, 'cc') || $key === $value); } } function cc_author_link(){ global $post; if (defined('BP_VERSION')) { echo sprintf( __('by %s', 'cc'), bp_core_get_userlink($post->post_author) ); }else{ echo sprintf( __('by %s', 'cc'), ''. get_the_author_meta( 'display_name' ) .'' ); } } /* * Checking posts order on different archive pages */ function archive_post_order($query_string){ global $cap, $authordata; if((is_category() && check_value($cap->posts_lists_category_order,'ASC','===')) || (is_tag() && check_value($cap->posts_lists_tag_order,'ASC','===')) || (is_author() && check_value($cap->posts_lists_author_order,'ASC','===')) || (is_date() && check_value($cap->posts_lists_date_order,'ASC','==='))){ query_posts($query_string.'&order=ASC'); } } function cc_exclude_home_3_posts( $query ) { global $cap; if (($cap->default_homepage_last_posts == 'show' || $cap->default_homepage_last_posts == __('show','cc')) && $query->is_home() && $query->is_main_query() ) { $query->set( 'offset', '3' ); } } add_action( 'pre_get_posts', 'cc_exclude_home_3_posts' ); /* * Alternative author archive check */ function custom_is_author(){ var_dump(is_archive()); return (is_archive() && !is_category() && !is_tag() && !is_date())? true:false; }