Skip to content

Instantly share code, notes, and snippets.

@larsschenk
Last active July 16, 2016 13:25
Show Gist options
  • Save larsschenk/024f3db433f99b60e7bd2082b593efec to your computer and use it in GitHub Desktop.
Save larsschenk/024f3db433f99b60e7bd2082b593efec to your computer and use it in GitHub Desktop.
Wordpress Theme: Baylys Leible Child
/* Let the style.css empty by design and use this css instead.
This way we can work around the cache by increasing version numbers.
*/
#header {
background:#1F2D52 !important;
max-width: 100%;
}
#footer {
background:#1F2D52 !important;
}
#site-title h1 a {
text-transform: lowercase;
font-family: 'Baloo', cursive;
color: white !important;
font-size: 44px !important;
}
#site-nav a {
text-transform: lowercase !important;
font-family: 'Baloo', cursive;
color: white !important;
font-size: 24px !important;
}
/* laptop + desktop screens */
@media screen and (min-width: 1180px) {
#site-nav {
padding: 55px 25px 22px;
}
}
<?php
// slow down heartbeat
add_filter('heartbeat_send', 'my_heartbeat_settings');
function my_heartbeat_settings($response)
{
if ($_POST['interval'] != 60) {
$response['heartbeat_interval'] = 60;
}
return $response;
}
// remove unwanted dashboard widgets for relevant users
function remove_dashboard_widgets()
{
remove_meta_box('dashboard_primary', 'dashboard', 'normal'); // wp news
remove_meta_box('dashboard_quick_press', 'dashboard', 'side');
$user = wp_get_current_user();
if (!$user->has_cap('manage_options')) {
remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal');
remove_meta_box('dashboard_plugins', 'dashboard', 'normal');
remove_meta_box('dashboard_secondary', 'dashboard', 'normal');
remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal');
remove_meta_box('dashboard_recent_drafts', 'dashboard', 'side');
remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');
remove_meta_box('dashboard_right_now', 'dashboard', 'normal');
}
}
add_action('admin_init', 'remove_dashboard_widgets');
// load parent
add_action('wp_enqueue_scripts', 'enqueue_parent_theme_style');
function enqueue_parent_theme_style()
{
wp_enqueue_style('parent-style', get_template_directory_uri().'/style.css', array(), '1.1.1');
wp_enqueue_style('child-style', get_stylesheet_directory_uri().'/baylys-leible-child.css', array(), '1.0.7');
wp_enqueue_style('baloo', 'https://fonts.googleapis.com/css?family=Baloo');
}
<?php
/**
* The themes Header file.
*
* Displays all of the <head> section and everything up till </header>
*
* @package Baylys Leible Child
* @since Baylys 1.0.6
*/
?><!DOCTYPE html>
<!--[if lte IE 8]>
<html class="ie" <?php language_attributes(); ?>>
<![endif]-->
<html <?php language_attributes(); ?>>
<!--<![endif]-->
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width,initial-scale=1">
<title><?php wp_title( '|', true, 'right' ); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
<?php
$options = get_option('baylys_theme_options');
if( $options['custom_favicon'] != '' ) : ?>
<link rel="shortcut icon" type="image/ico" href="<?php echo $options['custom_favicon']; ?>" />
<?php endif ?>
<?php
$options = get_option('baylys_theme_options');
if( $options['custom_apple_icon'] != '' ) : ?>
<link rel="apple-touch-icon" href="<?php echo $options['custom_apple_icon']; ?>" />
<?php endif ?>
<!-- HTML5 enabling script for older IE -->
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<?php
wp_enqueue_script('jquery');
if ( is_singular() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
wp_head();
?>
<!-- Cookie Consent -->
<script type="text/javascript">
<?php
if (get_bloginfo('language')=='de-DE') {
echo 'window.cookieconsent_options = {"message":"Durch Nutzung der Site stimmen Sie der Verwendung von Cookies zu.","dismiss":"Alles klar","learnMore":"Hier erfahren Sie mehr.","link":"/impressum","theme":"dark-bottom"};';
} else {
echo 'window.cookieconsent_options = {"message":"This website uses cookies to ensure you get the best experience on our website","dismiss":"Got it!","learnMore":"More info","link":"/imprint","theme":"dark-bottom"};';
}
?>
</script>
<script async type="text/javascript" data-cfasync="true" src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/1.0.9/cookieconsent.min.js"></script>
<!-- /Cookie Consent -->
</head>
<body <?php body_class(); ?>>
<header id="header" class="clearfix">
<div id="site-nav-container" class="clearfix">
<div id="site-title">
<?php $options = get_option('baylys_theme_options');
if( $options['custom_logo'] != '' ) : ?>
<a href="<?php echo home_url( '/' ); ?>" class="logo"><img src="<?php echo $options['custom_logo']; ?>" alt="<?php bloginfo('name'); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" /></a>
<?php else: ?>
<a style="line-height: 100%; color: #ffffff; font-family: 'Baloo', cursive; font-size: 32px !important;" href="/" title="hanseatische sanitär">hanseatische sanitär</a><br />
<a style="color: #ffffff; font-family: 'Baloo', cursive; font-size: 30px !important;" href="/">klaus-otto leible gmbh</a>
<?php endif ?>
</div><!-- end #site-title -->
<a href="#nav-mobile" id="mobile-menu-btn"><?php _e('Menu', 'baylys') ?></a>
<nav id="site-nav">
<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
</nav><!-- end #site-nav -->
</div><!-- end #site-nav-container -->
</header><!-- end #header -->
<?php
// Check to see if the header image has been removed
$header_image = get_header_image();
if ( $header_image ) :
// Compatibility with versions of WordPress prior to 3.4.
if ( function_exists( 'get_custom_header' ) ) {
// We need to figure out what the minimum width should be for our featured image.
// This result would be the suggested width if the theme were to implement flexible widths.
$header_image_width = get_theme_support( 'custom-header', 'width' );
} else {
$header_image_width = HEADER_IMAGE_WIDTH;
}
?>
<?php
// The header image
// Check if this is a post or page, if it has a thumbnail, and if it's a big one
if ( is_singular() && has_post_thumbnail( $post->ID ) &&
( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) ) ) &&
$image[1] >= $header_image_width ) :
// Houston, we have a new header image!
echo '<div class="header-image">';
echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
echo '</div>';
else :
// Compatibility with versions of WordPress prior to 3.4.
if ( function_exists( 'get_custom_header' ) ) {
$header_image_width = get_custom_header()->width;
$header_image_height = get_custom_header()->height;
} else {
$header_image_width = HEADER_IMAGE_WIDTH;
$header_image_height = HEADER_IMAGE_HEIGHT;
}
?>
<?php if (is_front_page() ) : ?>
<div class="header-image">
<img src="<?php header_image(); ?>" width="<?php echo $header_image_width; ?>" height="<?php echo $header_image_height; ?>" alt="" />
</div><!-- end .header-image -->
<?php endif; ?>
<?php endif; // end check for featured image or standard header ?>
<?php endif; // end check for removed header image ?>
/*
Theme Name: Baylys Leible Child
Theme URI: http://www.ocx.de/baylys-leible-child/
Description: Baylys Leible Child Theme, https://gist.github.com/larsschenk/024f3db433f99b60e7bd2082b593efec
Author: Lars Schenk
Author URI: https://ocx.de
Template: baylys
Version: 1.0.7
Tags: light, responsive-layout
Text Domain: baylys-leible-child
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment