add_data( 'freshy-ie6', 'conditional', 'lt IE 7' );
wp_enqueue_style( 'freshy-ie7', get_template_directory_uri() . '/ie7.css', array( 'freshy' ) );
$wp_styles->add_data( 'freshy-ie7', 'conditional', 'IE 7' );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
}
add_action( 'wp_enqueue_scripts', 'freshy_scripts' );
function freshy_body_classes( $classes ) {
// Remove body classes that conflict with legacy CSS
$classes = array_merge( array_diff( $classes, array( 'date' ) ) );
return $classes;
}
add_filter( 'body_class', 'freshy_body_classes' );
if ( function_exists('register_sidebar') ) {
register_sidebar(array(
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
));
}
// modded version to highlight parent menu !
function freshy_wp_list_pages($args = '') {
parse_str($args, $r);
if ( !isset($r['depth']) )
$r['depth'] = 0;
if ( !isset($r['show_date']) )
$r['show_date'] = '';
if ( !isset($r['child_of']) )
$r['child_of'] = 0;
if ( !isset($r['title_li']) )
$r['title_li'] = __('Pages');
if ( !isset($r['echo']) )
$r['echo'] = 1;
$output = '';
$pages = & get_pages($args);
if ( $pages ) {
if ( $r['title_li'] )
$output .= '' . $r['title_li'] . '';
$page_tree = array();
foreach ( $pages as $page ) {
if(get_page_link($page->ID) != home_url()) {
$page_tree[$page->ID]['title'] = $page->post_title;
$page_tree[$page->ID]['name'] = $page->post_name;
if ( !empty($r['show_date']) ) {
if ( 'modified' == $r['show_date'] )
$page_tree[$page->ID]['ts'] = $page->post_modified;
else
$page_tree[$page->ID]['ts'] = $page->post_date;
}
if ( $page->post_parent != $page->ID)
$page_tree[$page->post_parent]['children'][] = $page->ID;
}
}
$output .= freshy_page_level_out($r['child_of'],$page_tree, $r, 0, false);
if ( $r['title_li'] )
$output .= '
';
}
$output = apply_filters('wp_list_pages', $output);
if ( $r['echo'] )
echo $output;
else
return $output;
}
// modded version to highlight parent menu !
function freshy_page_level_out($parent, $page_tree, $args, $depth = 0, $echo = true) {
global $wp_query, $post, $wpdb;
$queried_obj = $wp_query->get_queried_object();
$output = '';
$current_page = $post->ID ?? 0;
$i=0; // loop to get the top parent page
$page_query = false;
while($current_page) {
$i++;
if ($i>100) break; // avoid infinite loop
$page_query = $wpdb->get_row("SELECT ID, post_title, post_parent FROM $wpdb->posts WHERE ID = '$current_page'");
$current_page = $page_query->post_parent;
}
$parent_id = $page_query->ID ?? 0;
$indent = str_repeat("\t", $depth? $depth : 0);
if ( !is_array($page_tree[$parent]['children']) )
return false;
foreach ( $page_tree[$parent]['children'] as $page_id ) {
$cur_page = $page_tree[$page_id];
$title = $cur_page['title'];
$css_class = 'page_item';
if ( ( ( isset( $queried_obj->ID ) && $page_id == $queried_obj->ID ) || $page_id == $parent_id) && !is_front_page() )
$css_class .= ' current_page_item';
$output .= $indent . '' . $title . '';
if ( isset($cur_page['ts']) ) {
$format = get_option('date_format');
if ( isset($args['date_format']) )
$format = $args['date_format'];
$output .= " " . mysql2date($format, $cur_page['ts']);
}
if ( isset($cur_page['children']) && is_array($cur_page['children']) ) {
$new_depth = $depth + 1;
if ( !$args['depth'] || $depth < ($args['depth']-1) ) {
$output .= "$indent\n";
$output .= freshy_page_level_out($page_id, $page_tree, $args, $new_depth, false);
$output .= "$indent
\n";
}
}
$output .= "$indent\n";
}
if ( $echo )
echo $output;
else
return $output;
}
// SET OPTIONS
$freshy_options=array();
//update_option('freshy_options', $freshy_options);
$freshy_theme_default=array();
$freshy_theme_red=array();
$freshy_theme_blue=array();
$freshy_theme_lime=array();
freshy_set_options();
function freshy_set_options() {
$freshy_theme_default = [];
global $freshy_options, $freshy_theme_red, $freshy_theme_lime, $freshy_theme_blue;
$freshy_theme_default['highlight_color']='#FF3C00';
$freshy_theme_default['description_color']='#ADCF20';
$freshy_theme_default['author_color']='#a3cb00';
$freshy_theme_default['sidebar_bg']='#FFFFFF';
$freshy_theme_default['sidebar_titles_color']='#f78b0c';
$freshy_theme_default['sidebar_titles_bg']='#FFFFFF';
$freshy_theme_default['menu_bg']='menu_start_triple.gif';
$freshy_theme_default['menu_color']='#000000';
$freshy_theme_default['header_bg']='header_image6.jpg';
$freshy_theme_default['header_bg_custom']='';
$freshy_theme_default['sidebar_titles_type']='stripes';
$freshy_theme_default['first_menu_label']='Home';
$freshy_theme_default['blog_menu_label']='Blog';
$freshy_theme_default['last_menu_label']='Contact';
$freshy_theme_default['last_menu_type']='';
$freshy_theme_default['contact_email']='';
$freshy_theme_default['contact_link']='';
$freshy_theme_default['menu_type']='auto';
$freshy_theme_default['args_pages']='sort_column=menu_order&title_li=';
$freshy_theme_default['args_cats']='hide_empty=0&sort_column=name&optioncount=1&title_li=&hierarchical=1&feed=RSS&feed_image='.get_stylesheet_directory_uri().'/images/icons/feed-icon-10x10.gif';
$freshy_theme_lime['highlight_color']='#FF3C00';
$freshy_theme_lime['description_color']='#ADCF20';
$freshy_theme_lime['author_color']='#a3cb00';
$freshy_theme_lime['sidebar_bg']='#FFFFFF';
$freshy_theme_lime['sidebar_titles_color']='#f78b0c';
$freshy_theme_lime['sidebar_titles_bg']='#FFFFFF';
$freshy_theme_lime['menu_bg']='menu_start_triple.gif';
$freshy_theme_lime['menu_color']='#000000';
$freshy_theme_lime['header_bg']='header_image6.jpg';
$freshy_theme_lime['header_bg_custom']='';
$freshy_theme_lime['sidebar_titles_type']='stripes';
$freshy_theme_red['highlight_color']='#d80f2a';
$freshy_theme_red['description_color']='#eca50d';
$freshy_theme_red['author_color']='#eca50d';
$freshy_theme_red['sidebar_bg']='#F3F3F3';
$freshy_theme_red['sidebar_titles_color']='#000000';
$freshy_theme_red['sidebar_titles_bg']='#c2c2c2';
$freshy_theme_red['menu_bg']='menu_start_triple_red.gif';
$freshy_theme_red['menu_color']='#ffffff';
$freshy_theme_red['header_bg']='header_image8.jpg';
$freshy_theme_red['header_bg_custom']='';
$freshy_theme_red['sidebar_titles_type']='stripes';
$freshy_theme_blue['highlight_color']='#f5690c';
$freshy_theme_blue['description_color']='#ff6c00';
$freshy_theme_blue['author_color']='#f5bb0c';
$freshy_theme_blue['sidebar_bg']='#dbefff';
$freshy_theme_blue['sidebar_titles_color']='#0f80d8';
$freshy_theme_blue['sidebar_titles_bg']='#FFFFFF';
$freshy_theme_blue['menu_bg']='menu_start_triple_lightblue.gif';
$freshy_theme_blue['menu_color']='#ffffff';
$freshy_theme_blue['header_bg']='header_image3.jpg';
$freshy_theme_blue['header_bg_custom']='';
$freshy_theme_blue['sidebar_titles_type']='stripes';
$freshy_options=$freshy_theme_default;
}
// ADD HEAD TO THE TEMPLATE
add_action('wp_head', 'freshy_head');
function freshy_head() {
global $freshy_options, $freshy_theme_lime;
$menu_triple = str_replace("menu_start_triple", "menu_triple", $freshy_options['menu_bg']);
$menu_end_triple = str_replace("menu_start_triple", "menu_end_triple", $freshy_options['menu_bg']);
?>
'ffffff',
'border' => 'cccccc',
'text' => '000000',
'link' => '515151',
'url' => 'f78b0c',
);
$content_width = 510;
// Header navigation menu
register_nav_menus( array(
'primary' => __( 'Primary Navigation', 'freshy' ),
) );
function freshy_add_menu_items( $items ) {
// hack-a-licious way to build the menu background images
$before = '';
$after = '';
// re-build list with our pre- and post-elements added on
$items = $before . $items . $after;
return $items;
}
add_filter( 'wp_nav_menu_items', 'freshy_add_menu_items' );
// TODO move the before/after images to the parent element to avoid first, last menu items
// Or just add the classes to first, last items
// Or use :first-child, :last-child (no IE6 support)
function freshy_page_menu() { // fallback for primary navigation ?>
comment_author_email == get_the_author_meta( 'email' ) ) $author_comment_class=' author_comment';
?>
id="comment-">
tag based on what is being viewed.
*
* @since Freshy 1.0
*/
function freshy_wp_title( $title, $sep ) {
global $page, $paged;
if ( is_feed() )
return $title;
// Add the blog name
$title .= get_bloginfo( 'name' );
// Add the blog description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) )
$title .= " $sep $site_description";
// Add a page number if necessary:
if ( $paged >= 2 || $page >= 2 )
$title .= " $sep " . sprintf( __( 'Page %s', 'freshy' ), max( $paged, $page ) );
return $title;
}
add_filter( 'wp_title', 'freshy_wp_title', 10, 2 );
/**
* Implement the Custom Header feature
*/
require( get_template_directory() . '/inc/custom-header.php' );