'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' => '', 'before_title' => '' . 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 '"; } 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');