'FFFFFF', 'wp-head-callback' => 'afford_custom_background_cb')); /** * Adds supports for Theme menu. * Afford uses wp_nav_menu() in a single location to diaplay one single menu. */ register_nav_menu('primary', 'Primary Menu'); /** * Add support for Post Thumbnails. * Defines a custom name and size for Thumbnails to be used in the theme. * * Note: In order to use the default theme thumbnail, add_image_size() must be removed * and 'affordThumb' value must be removed from the_post_thumbnail in the loop file. */ add_theme_support('post-thumbnails'); add_image_size('affordThumb', 190, 130, true); } add_action( 'after_setup_theme', 'afford_setup' ); /** * Callback for custom background * * @see wp-includes/theme.php function _custom_background_cb() * @return string Custom CSS */ function afford_custom_background_cb() { // $background is the saved custom image, or the default image. $background = set_url_scheme(get_background_image()); // $color is the saved custom color. // A default has to be specified in style.css. It will not be printed here. $color = get_background_color(); if ($color === get_theme_support('custom-background', 'default-color')) { $color = false; } if (!$background && !$color) return; $style = $color ? "background-color: #$color;" : ''; if ($background) { $image = " background-image: url('$background');"; $repeat = get_theme_mod('background_repeat', get_theme_support('custom-background', 'default-repeat')); if (!in_array($repeat, array('no-repeat', 'repeat-x', 'repeat-y', 'repeat'))) $repeat = 'repeat'; $repeat = " background-repeat: $repeat;"; $position = get_theme_mod('background_position_x', get_theme_support('custom-background', 'default-position-x')); if (!in_array($position, array('center', 'right', 'left'))) $position = 'left'; $position = " background-position: top $position;"; $attachment = get_theme_mod('background_attachment', get_theme_support('custom-background', 'default-attachment')); if (!in_array($attachment, array('fixed', 'scroll'))) $attachment = 'scroll'; $attachment = " background-attachment: $attachment;"; $style .= $image . $repeat . $position . $attachment; } ?> 'primary', 'container_id' => 'menu', 'menu_class' => 'sf-menu afford_menu', 'menu_id' => 'afford_menu', 'fallback_cb' => 'afford_nav_fallback' // Fallback function in case no menu item is defined. )); } /** * Displays a custom menu in case either no menu is selected or * menu does not contains any items or wp_nav_menu() is unavailable. * * @since 1.0 */ function afford_nav_fallback() { ?> __('Right Sidebar', 'afford'), 'id' => 'right_sidebar', 'description' => __('Right Sidebar', 'afford'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); // Footerbox Sidebar #1 register_sidebar(array( 'name' => __('Footerbox Sidebar #1', 'afford'), 'id' => 'footerbox_sidebar_1', 'description' => __('Footerbox Sidebar #1', 'afford'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); // Footerbox Sidebar #2 register_sidebar(array( 'name' => __('Footerbox Sidebar #2', 'afford'), 'id' => 'footerbox_sidebar_2', 'description' => __('Footerbox Sidebar #2', 'afford'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); // Footerbox Sidebar #3 register_sidebar(array( 'name' => __('Footerbox Sidebar #3', 'afford'), 'id' => 'footerbox_sidebar_3', 'description' => __('Footerbox Sidebar #3', 'afford'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); // Top Sidebar /* register_sidebar(array( 'name' => __('Top Sidebar', 'afford'), 'id' => 'top_sidebar', 'description' => __('Top Sidebar', 'afford'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); */ } add_action( 'widgets_init', 'afford_sidebars' ); /** * Enqueue CSS and JS files * * @since 1.0 */ function afford_enqueue() { wp_enqueue_style('google-font-lato', '//fonts.googleapis.com/css?family=Lato:400,100italic,100,300,300italic,700,700italic,900,900italic'); wp_enqueue_style('afford-font-awesome', AFFORD_ADMIN_CSS_URL . 'font-awesome.4.1.0.css'); wp_enqueue_style('afford-stylesheet', get_stylesheet_uri(), false, '1.0.0', 'all' ); // Enqueue (comment-reply )Javascript in case of threaded comments. if (is_singular() && comments_open() && get_option('thread_comments')) : wp_enqueue_script('comment-reply'); endif; wp_enqueue_script('afford-superfish', AFFORD_GLOBAL_JS_URL . 'superfish.min.js', array( 'jquery' ), '1.4.8', true); wp_enqueue_script('jquery-color'); wp_enqueue_script('afford-custom', AFFORD_GLOBAL_JS_URL . 'custom.js', array( 'jquery' ), '1.0.0', true); } add_action( 'wp_enqueue_scripts', 'afford_enqueue'); /** * Hooks respond.js for IE in the wp_head hook. * * @since 1.0 */ function afford_enqueue_ie_script() { echo "\n"; ?>= 2 || $page >= 2) $title .= " $sep " . sprintf(__('Page %s', 'afford'), max($paged, $page)); return $title; } add_filter( 'wp_title', 'afford_modify_title', 10, 2 ); /** * Used to return body classes * * @param array $classes * @return array * @since 1.0 */ function afford_body_class($classes) { if(is_single()): $classes[] = 'single-template'; $classes[] = 'post-template'; elseif(is_page()): $classes[] = 'page-template'; $classes[] = 'post-template'; elseif(is_front_page()): $classes[] = 'home-template'; elseif(is_home()): $classes[] = 'home-template'; $classes[] = 'blog-template'; elseif (is_archive()): $classes[] = 'archive-template'; elseif(is_404()): $classes[] = 'archive-template'; $classes[] = 'empty-template'; elseif(is_search()): $classes[] = 'archive-template'; $classes[] = 'search-template'; endif; $classes[] = 'orange'; $classes[] = 'right_sidebar'; $classes[] = 'theme-wide'; $classes[] = 'thumbnail-left'; return $classes; } add_filter('body_class', 'afford_body_class'); /** * Returns social icons individually * * @param string $option Name of option in DB * @param string $title * @param string $icon Name of icon as in mdf-[icon] * @return string * * @since 1.0.0 */ function afford_get_social_section_individual_icon($option, $title, $icon) { $output = ''; if(afford_get_option($option)){ $output .= ''; } return $output; } /** * Used to display social section * * @since 1.0 */ function afford_social_section_show() { if(!afford_get_option('disable_social_section')): $output = false; $output .= afford_get_social_section_individual_icon('facebook', 'Facebook', 'facebook'); $output .= afford_get_social_section_individual_icon('twitter', 'Twitter', 'twitter'); $output .= afford_get_social_section_individual_icon('rss', 'RSS feed', 'rss'); ?>

max_num_pages > 1): ?>
comment_type ): case '' : // Proceed with normal comments. ?>
  • id="li-comment-"> comment_approved == '0') : ?>
    comment_parent ?> comment_parent) ?> Replied to %s', $afford_the_comment_author ) ?>
    ', 'afford'), sprintf('%s', get_comment_author_link())) ?>
    $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    ', '
    ');?>
  • ' . get_bloginfo('name') . ' ' . __('Blog', 'afford') . ''; } add_filter('afford_blog_template_heading_filter', 'afford_blog_template_heading_text', 10); /** * Filters and add class to 'loop-section-col' section. * * @param NULL $default '' Nothing by default * @param integer $loop_count An integer starting from 1,2,3,,,, * @return string Name of CSS class * @since 1.0 */ function afford_loop_section_col_class_modifier($default, $loop_count) { if($loop_count % 2 == 1): return 'grid-float-left'; else: return 'grid-float-right'; endif; } add_filter('afford_loop_section_col_class_filter', 'afford_loop_section_col_class_modifier', 10, 2); /** * * @param type $button * @param type $text * @return type */ function afford_wp_readmore_link($button, $text) { $post = get_post(); return '
    ID}\">Read more
    "; } add_filter('the_content_more_link', 'afford_wp_readmore_link', 100, 2); /** * Outputs CSS for customizer options * * @since 1.0 */ function afford_customizer_css() { $output = ''; $options_color = array( 'color_site_title' => '#wrapper .site-title a', 'color_site_desc' => '#wrapper .site-description', 'color_blog_p_title' => '#wrapper .loop-post-title h1 a', 'color_blog_p_meta' => '#wrapper .loop-post-meta, #wrapper .loop-post-meta .loop-meta-comments a', 'color_blog_p_content' => '#wrapper .loop-post-excerpt', 'color_p_title' => '#wrapper .post-title h1', 'color_p_meta' => '#wrapper .post-meta', 'color_p_content' => '#wrapper .post-content', ); $output .= "\n" . '' . "\n"; echo $output; } add_action('wp_head', 'afford_customizer_css');