File: /home/muoapartman/www/wp-content/themes/hotel/functions.php
<?php
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which runs
* before the init hook. The init hook is too late for some features, such as indicating
* support post thumbnails.
*/
function hotel_theme_setup() {
/* Load the primary menu. */
remove_action( 'omega_before_header', 'omega_get_primary_menu' );
add_action( 'omega_header', 'omega_get_primary_menu' );
add_action( 'omega_header', 'hotel_intro');
add_filter( 'omega_site_description', 'hotel_site_description' );
/* Add support for a custom header image. */
add_theme_support(
'custom-header',
array( 'header-text' => false,
'flex-width' => true,
'uploads' => true,
'default-image' => get_stylesheet_directory_uri() . '/images/header.png' ) );
/* Custom background. */
add_theme_support(
'custom-background',
array( 'default-color' => 'e6dabb' )
);
add_action('init', 'hotel_init', 1);
}
add_action( 'after_setup_theme', 'hotel_theme_setup', 11 );
/* disable site description */
function hotel_site_description($desc) {
$desc = "";
return $desc;
}
function hotel_init() {
if(!is_admin()){
wp_enqueue_script("tinynav", get_stylesheet_directory_uri() . '/js/tinynav.js', array('jquery'));
}
}
/* display custom header image */
function hotel_intro() {
echo "<div class='intro'>";
if(is_front_page()) {
if (get_header_image()) {
echo '<img class="header-image" src="' . esc_url( get_header_image() ) . '" alt="' . get_bloginfo( 'description' ) . '" />';
}
} else {
// get title
$id = get_option('page_for_posts');
if ( is_day() || is_month() || is_year() || is_tag() || is_category() || is_singular('post' ) || is_home() ) {
$the_title = get_the_title($id);
} else {
$the_title = get_the_title();
}
if (( 'posts' == get_option( 'show_on_front' )) && (is_day() || is_month() || is_year() || is_tag() || is_category() || is_singular('post' ) || is_home())) {
echo '<img class="header-image" src="' . esc_url( get_header_image() ) . '" alt="' . $the_title . '" />';
} elseif(is_home() || is_singular('post' ) ) {
if ( has_post_thumbnail($id) ) {
echo get_the_post_thumbnail( $id, 'full' );
} elseif (get_header_image()) {
echo '<img class="header-image" src="' . esc_url( get_header_image() ) . '" alt="' . $the_title . '" />';
}
} elseif ( has_post_thumbnail() && is_singular('page' ) ) {
the_post_thumbnail();
} elseif (get_header_image()) {
echo '<img class="header-image" src="' . esc_url( get_header_image() ) . '" alt="' . $the_title . '" />';
}
}
echo "</div>";
}