Skip to content

Commit

Permalink
add Custom Headers theme function
Browse files Browse the repository at this point in the history
  • Loading branch information
fcojgodoy committed Dec 28, 2016
1 parent 8f3973c commit 414efaa
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 7 deletions.
3 changes: 2 additions & 1 deletion functions.php
Expand Up @@ -20,7 +20,8 @@
'lib/customizer.php', // Theme customizer
'lib/userfields.php', // Add user's fields
'lib/custom-logo.php', // Add Theme logo support
'lib/piklist-checker.php' // Add Piklist Checker
'lib/piklist-checker.php', // Add Piklist Checker
'lib/custom-headers.php' // Add Custom Headers support
];

foreach ($sage_includes as $file) {
Expand Down
33 changes: 33 additions & 0 deletions lib/custom-headers.php
@@ -0,0 +1,33 @@
<?php

add_theme_support( 'custom-header' );

function themename_custom_header_setup() {
$defaults = array(
// Default Header Image to display
'default-image' => get_template_directory_uri() . '/images/headers/default.jpg',
// Display the header text along with the image
'header-text' => true,
// Header text color default
'default-text-color' => '000',
// Header image width (in pixels)
'width' => 1000,
// Header image height (in pixels)
'height' => 198,
// Width will be used as suggested dimensions instead
'flex-width' => true,
// Height will be used as suggested dimensions instead
'flex-height' => true,
// Header image random rotation default
'random-default' => false,
// Enable upload of image file in admin
'uploads' => true,
// function to be called in theme head section
'wp-head-callback' => 'wphead_cb',
// function to be called in preview page head section
'admin-head-callback' => 'adminhead_cb',
// function to produce preview markup in the admin screen
'admin-preview-callback' => 'adminpreview_cb',
);
}
add_action( 'after_setup_theme', __NAMESPACE__ . '\\themename_custom_header_setup' );
7 changes: 4 additions & 3 deletions lib/piklist-checker.php
@@ -1,9 +1,10 @@
<?php

/*
* Add Piklist Checker
* https://piklist.com/learn/doc/piklist-checker/
*/
* Add Piklist Checker
* https://piklist.com/learn/doc/piklist-checker/
*/

function add_piklist_checker(){
if(is_admin()){
include_once('class-piklist-checker.php');
Expand Down
10 changes: 7 additions & 3 deletions templates/header.php
@@ -1,8 +1,12 @@
<?php if (is_front_page()) : ?>

<!-- Organism: front-page-banner (Add background-image style if is_front_page) -->
<header class="banner front-page-banner" style="background-image: url('http://demo.ghost.io/content/images/2014/09/testimg-home-1.jpg')">
<?php if (is_front_page()) : ?>

<?php if ( get_header_image() ) : ?>
<!-- Organism: front-page-banner (Add background-image style if is_front_page) -->
<header class="banner front-page-banner" style="background-image: url('<?php header_image(); ?>')">
<?php else: ?>
<header class="banner">
<?php endif; ?>

<?php elseif (is_author()) : ?>

Expand Down

0 comments on commit 414efaa

Please sign in to comment.