Created
May 16, 2016 17:45
-
-
Save anthonysbrown/9dfd304d4d9172bfd348896b1b1ba05e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$funeralpress_theme = new funeralpress_theme; | |
add_action( 'wp_enqueue_scripts',array($funeralpress_theme , 'scripts')); | |
add_action( 'wp_head',array($funeralpress_theme , 'wp_head')); | |
add_action( 'after_setup_theme',array($funeralpress_theme , 'register_menu')); | |
add_action( 'woo_header_inside', array($funeralpress_theme , 'header_contact'), 11 ); | |
#add_filter( 'wpfh/obituary/top', array($funeralpress_theme , 'obit_top'), 11,2 ); | |
class funeralpress_theme{ | |
function obit_top($obit_top,$r){ | |
unset($obit_top); | |
if($r[0]['maiden'] != ''){ | |
$maiden = ' ('.stripslashes($r[0]['maiden']).') '; | |
} | |
$name = '' . stripslashes($r[0]['first_name']) . ' ' . stripslashes($r[0]['middle']) . ' ' . stripslashes($r[0]['last_name']) . ' ' . $maiden . ''; | |
$r[0]['fullname'] = $name; | |
add_filter('wp_title', array( | |
$this, | |
'obitName' | |
)); | |
if ($r[0]['maiden'] != "") { | |
$maiden = ' (' . stripslashes($r[0]['maiden']) . ') '; | |
} else { | |
$maiden = ''; | |
} | |
if ($r[0]['vet'] == 1 && wpfh_feature_disabled('Veteran Info') == false) { | |
$class = 'wpfh_obit_vet'; | |
$vet = '<div class="wpfh_veteran">U.S. Veteran</div><div style="clear:both"></div>'; | |
} else { | |
$vet = ''; | |
$class = ''; | |
} | |
if($r[0]['birth_date'] != "0000-00-00" ){ | |
$birth_date = '' . wpfh_date($r[0]['birth_date']). ' - '; | |
}else{ | |
$birth_date = ''; | |
} | |
if($r[0]['death_date'] != "0000-00-00" ){ | |
$death_date = '' . wpfh_date($r[0]['death_date']) . ''; | |
}else{ | |
$death_date = ''; | |
} | |
if($r[0]['burial_date'] != "0000-00-00" ){ | |
$burial_date = '' . wpfh_date($r[0]['burial_date']) . ''; | |
}else{ | |
$burial_date = ''; | |
} | |
$obit_top .= '<div id="wpfh_main_obit"> | |
<div class="wpfh_main_obit_info '.$class.'"> | |
<div id="wpfh_main_obit_left"> '; | |
$obit_top .='' . $vet . '<div class="wpfh_obit_image" style="width:'.get_option('wpfh_obit_w').'px;"><a href="'.$r[0]['photo'] .'" class="wpfh_colorbox"><img src="'.wpfh_thumbnail($r[0]['photo'], get_option('wpfh_obit_w',150),get_option('wpfh_obit_h',150)).'" ></a>'; | |
$under_image = ''; | |
$obit_top .= apply_filters('wpfh_obit_under_image',$under_image,$r); | |
$obit_top .='</div>'; | |
$obit_top = apply_filters('wpfp_main_before_name',$obit_top,$r); | |
$obit_top .=' | |
'; | |
$obit_top = apply_filters('wpfp_main_after_name',$obit_top,$r); | |
$obit_top .= '</div>'; | |
$obit_top = apply_filters('wpfp_main_after_death_date',$obit_top,$r); | |
$obit_top .='<div id="wpfh_main_obit_right">'; | |
$obit_top .= ' <h2>' . $name . '</h2> | |
<p class="wpfh_obit_date"><em>'. $birth_date .'' . $death_date . '</em></p>'; | |
if (get_option('wpfh_site_type') == 'funeral') { | |
$obit_notes .='<p><strong>'.__("Service Date","sp-wpfh").':</strong> ' .$burial_date . '</p>'; | |
}else{ | |
$obit_notes .='<p><strong>'.__("Burial Date","sp-wpfh").'</strong> ' .$burial_date . '</p>'; | |
} | |
$obit_notes = apply_filters('wpfp_main_after_service_date',$obit_notes,$r); | |
if($r[0]['obit_notes'] != ''){ | |
$obit_notes .= apply_filters('the_content',stripslashes($r[0]['obit_notes'])); | |
} | |
$obit_notes = apply_filters('wpfp_main_obit_right_column_top', $obit_notes,$r); | |
if($obit_notes != ''){ | |
$obit_top.='<p>' . $obit_notes . '</p>'; | |
} | |
$obit_top = apply_filters('wpfp_main_after_notes',$obit_top,$r); | |
$wpfh_obit_top_right .= apply_filters('wpfh_obit_top_right',$wpfh_obit_top_right,$r); | |
if(!is_array($wpfh_obit_top_right)){ | |
$obit_top .= $wpfh_obit_top_right; | |
} | |
$obit_top .=' | |
</div> | |
<div style="clear:both"></div> | |
</div>'; | |
return $obit_top; | |
} | |
function scripts(){ | |
wp_enqueue_style( 'funeralpress-slider', get_stylesheet_directory_uri(). '/css/bpHS.css'); | |
wp_enqueue_script( 'jquery-touchswipe', get_stylesheet_directory_uri(). '/js/vendors/jquery.touchSwipe.min.js', array('jquery')); | |
wp_enqueue_script( 'funeralpress-slider', get_stylesheet_directory_uri(). '/js/bpHS.js', array('jquery-touchswipe')); | |
wp_enqueue_script( 'funeralpress-custom', get_stylesheet_directory_uri(). '/js/custom.js', array('funeralpress-slider')); | |
} | |
function header_contact(){ | |
echo '<div class="header-contact"> | |
<div class="header-contact-address"><p>'.get_option('wpfh_address', 'Set your address in settings').'</p></div> | |
<div class="header-contact-phone"><span>Call Us</span> '.get_option('wpfh_phone_number', 'Set your phone in settings').'</div> | |
</div>'; | |
} | |
function css(){ | |
} | |
function wp_head(){ | |
global $woo_options; | |
echo '<style type="text/css"> | |
.slider-nav-menu{ | |
background-color:'.$woo_options['woo_nav_bg'].' !important; | |
} | |
.wpfh-subscribe-shortcode{ background-color:'.$woo_options['woo_nav_bg'].' !important;} | |
.header-contact-phone span{ background-color:'.$woo_options['woo_nav_bg'].' !important;} | |
</style>'; | |
} | |
function register_menu() { | |
register_nav_menu( 'slider_nav', 'Slider Menu' ); | |
} | |
function slider(){ | |
global $woo_options; | |
$args = array('post_type' => 'slide'); | |
$sliders= new WP_Query($args ); | |
echo '<div class="bp-hs"> | |
<div class="bp-hs_inner"> | |
'; | |
foreach($sliders->get_posts() as $slider){ | |
$image = wp_get_attachment_url( get_post_thumbnail_id($slider->ID)); | |
echo '<div class="bp-hs_inner__item"><img src="'.$image.'"></div>'; | |
} | |
echo ' | |
</div> | |
</div>'; | |
; | |
$menu_name = 'slider_nav'; | |
if ( ( $locations = get_nav_menu_locations() ) && isset( $locations[ $menu_name ] ) ) { | |
$menu = wp_get_nav_menu_object( $locations[ $menu_name ] ); | |
$menu_items = wp_get_nav_menu_items($menu->term_id); | |
} | |
if($menu_items > 0){ | |
$percentage = 100 / count($menu_items) - 2; | |
echo '<style type="text/css"> | |
.slider-nav-menu li a{ | |
width:'.$percentage .'%; | |
padding:1%; | |
} | |
.slider-nav-menu{ | |
background-color:'.$woo_options['woo_nav_bg'].'; | |
} | |
.wpfh-subscribe-shortcode{ background-color:'.$woo_options['woo_nav_bg'].';} | |
.header-contact-phone span{ background-color:'.$woo_options['woo_nav_bg'].';} | |
</style>'; | |
} | |
echo '<div class="col-full"><div class="slider-nav-menu">'; | |
$walker = new FuneralPress_menu_Walker; | |
wp_nav_menu( array( 'theme_location' => 'slider_nav', 'walker' => $walker ) ); | |
echo '<div style="clear:both"></div></div></div>'; | |
} | |
} | |
class FuneralPress_menu_Walker extends Walker_Nav_Menu { | |
function start_el(&$output, $item, $depth, $args) { | |
global $wp_query; | |
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; | |
$class_names = $value = ''; | |
$classes = empty( $item->classes ) ? array() : (array) $item->classes; | |
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) ); | |
$class_names = ' class="' . esc_attr( $class_names ) . '"'; | |
$output .= $indent . '<li id="menu-item-'. $item->ID . '"' . $value . $class_names .'>'; | |
$attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : ''; | |
$attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : ''; | |
$attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : ''; | |
$attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : ''; | |
$item_output = $args->before; | |
$item_output .= '<a'. $attributes .'>'; | |
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after; | |
$item_output .= '<br /><span class="sub">' . $item->description . '</span>'; | |
$item_output .= '</a>'; | |
$item_output .= $args->after; | |
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment