Permalink
Browse files

Added customizer API controls

  • Loading branch information...
lacymorrow committed Mar 20, 2014
1 parent eb98bf3 commit 074cb4283376d23a70b5925a2ce761fceae484f7
Showing with 75 additions and 39 deletions.
  1. +1 βˆ’0 css/screen.css
  2. +4 βˆ’6 footer.php
  3. +28 βˆ’0 functions.php
  4. +6 βˆ’8 header.php
  5. +16 βˆ’0 inc/customizer.php
  6. +2 βˆ’2 inc/template-tags.php
  7. +1 βˆ’4 index.php
  8. +15 βˆ’11 js/customizer.js
  9. +2 βˆ’4 page.php
  10. +0 βˆ’4 single.php
View
@@ -379,6 +379,7 @@ margin on the iframe, cause it breaks stuff. */
.blog-logo {
text-decoration: none;
color: white;
}
/* Yo-logo. Yolo-go. Upload one in ghost/settings/ */
View
@@ -8,19 +8,17 @@
*/
?>
</div><!-- #content -->
<footer id="colophon" class="site-footer" role="contentinfo">
<div class="site-info">
<section class="copyright">&copy; <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a> &bull; All rights reserved.</section>
<a href="<?php echo esc_url( __( 'http://wordpress.org/', 'casper' ) ); ?>"><?php printf( __( 'Proudly powered by %s', 'casper' ), 'WordPress' ); ?></a>
<section class="copyright">&copy; <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a> &bull; Inspired by <a class="icon-ghost" href="http://ghost.org">Ghost</a>.</section>
<!-- <a href="<?php echo esc_url( __( 'http://wordpress.org/', 'casper' ) ); ?>"><?php printf( __( 'Proudly powered by %s', 'casper' ), 'WordPress' ); ?></a>
<span class="sep"> | </span>
<?php printf( __( 'Theme: %1$s by %2$s.', 'casper' ), 'Casper', '<a href="http://underscores.me/" rel="designer">Underscores.me</a>' ); ?>
<?php printf( __( 'Theme: %1$s by %2$s.', 'casper' ), 'Casper', '<a href="http://underscores.me/" rel="designer">Underscores.me</a>' ); ?> -->
</div><!-- .site-info -->
</footer><!-- #colophon -->
</div><!-- #page -->
<?php wp_footer(); ?>
</main><!-- /#content -->
</body>
</html>
View
@@ -48,6 +48,21 @@ function casper_setup() {
// Enable support for Post Formats.
add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link' ) );
// Enable support for a custom header image
$defaults = array(
'default-image' => '',
'width' => 0,
'height' => 0,
'uploads' => true,
'wp-head-callback' => ''
);
global $wp_version;
if ( version_compare( $wp_version, '3.4', '>=' ) ) :
add_theme_support( 'custom-header', $defaults );
else :
add_custom_image_header( $wp_head_callback, $admin_head_callback );
endif;
// Setup the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'casper_custom_background_args', array(
'default-color' => 'ffffff',
@@ -122,3 +137,16 @@ function casper_scripts() {
* Load Jetpack compatibility file.
*/
require get_template_directory() . '/inc/jetpack.php';
/**
* Customizer hook
*/
function tcx_customizer_css() {
?>
<style type="text/css">
section a { color: <?php echo get_theme_mod( 'tcx_link_color' ); ?>; }
header .blog-title a, header .blog-description { color: #<?php echo get_theme_mod('header_textcolor'); ?>; }
</style>
<?php
}
add_action( 'wp_head', 'tcx_customizer_css' );
View
@@ -24,20 +24,18 @@
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<link rel="shortcut icon" href="{{asset "favicon.ico"}}">
<link rel="shortcut icon" href="<?php echo get_template_directory(); ?>/favicon.ico">
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Noto+Serif:400,700,400italic|Open+Sans:700,400" />
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<div id="page" class="hfeed site">
<header id="masthead" role="banner" class="site-head" <?php if(is_home()){ ?>style="background-image: url({{@blog.cover}})"<?php } ?>>
<header id="masthead" role="banner" class="site-head site-header" <?php if(is_home()){ ?>style="background-image: url({{@blog.cover}})"<?php } ?>>
<div class="vertical">
<div class="site-head-content inner">
{{#if @blog.logo}}<a class="blog-logo" href="<?php echo esc_url( home_url( '/' ) ); ?>"><img src="{{@blog.logo}}" alt="Blog Logo" /></a>{{/if}}
<h1 class="blog-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
<a class="blog-logo" href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php echo get_avatar(1); ?></a>
<h1 class="blog-title"><a class="blog-logo" href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
<h2 class="blog-description"><?php bloginfo( 'description' ); ?></h2>
</div>
</div>
@@ -47,6 +45,6 @@
<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
</nav> --><!-- #site-navigation -->
</header>
</header><!-- #masthead -->
<div id="content" class="site-content">
<main id="content" class="content" role="main">
View
@@ -13,7 +13,23 @@
function casper_customize_register( $wp_customize ) {
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->get_setting( 'background_color' )->transport = 'postMessage';
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
$wp_customize->add_setting( 'tcx_link_color' , array(
'default' => '#4a4a4a',
'transport' => 'postMessage',
) );
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'link_color',
array(
'label' => __( 'Link Color', 'tcx' ),
'section' => 'colors',
'settings' => 'tcx_link_color'
)
)
);
}
add_action( 'customize_register', 'casper_customize_register' );
View
@@ -72,7 +72,7 @@ function casper_post_nav() {
function casper_posted_on() {
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string .= '<time class="updated" datetime="%3$s">%4$s</time>';
//$time_string .= '<time class="updated" datetime="%3$s">%4$s</time>';
}
$time_string = sprintf( $time_string,
@@ -82,7 +82,7 @@ function casper_posted_on() {
esc_html( get_the_modified_date() )
);
printf( __( '<span class="posted-on">Posted on %1$s</span><span class="byline"> by %2$s</span>', 'casper' ),
printf( __( '<span class="posted-on">%1$s</span><span class="byline"> by %2$s</span>', 'casper' ),
sprintf( '<a href="%1$s" rel="bookmark">%2$s</a>',
esc_url( get_permalink() ),
$time_string
View
@@ -13,8 +13,6 @@
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main content" role="main">
<?php if ( have_posts() ) : ?>
@@ -39,7 +37,6 @@
<?php endif; ?>
</main>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
View
@@ -5,32 +5,36 @@
*/
( function( $ ) {
// Site title and description.
// blog title and description.
wp.customize( 'blogname', function( value ) {
value.bind( function( to ) {
$( '.site-title a' ).text( to );
$( '.blog-title a' ).text( to );
} );
} );
wp.customize( 'blogdescription', function( value ) {
value.bind( function( to ) {
$( '.site-description' ).text( to );
$( '.blog-description' ).text( to );
} );
} );
// Header text color.
wp.customize( 'header_textcolor', function( value ) {
value.bind( function( to ) {
if ( 'blank' === to ) {
$( '.site-title, .site-description' ).css( {
'clip': 'rect(1px, 1px, 1px, 1px)',
'position': 'absolute'
alert(to);
if ( 'blank' === to || '' === to || false === to) {
$( 'header .blog-title a, header .blog-description' ).css( {
'color' : 'inherit'
} );
} else {
$( '.site-title, .site-description' ).css( {
'clip': 'auto',
'color': to,
'position': 'relative'
$( 'header .blog-title a, header .blog-description' ).css( {
'color': to
} );
}
} );
} );
// Link color
wp.customize( 'tcx_link_color', function( value ) {
value.bind( function( to ) {
$( 'section a' ).css( 'color', to );
} );
});
} )( jQuery );
View
@@ -12,8 +12,7 @@
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main content" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'page' ); ?>
@@ -27,7 +26,6 @@
<?php endwhile; // end of the loop. ?>
</main>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
View
@@ -7,8 +7,6 @@
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main content" role="main">
<?php while ( have_posts() ) : the_post(); ?>
@@ -25,8 +23,6 @@
<?php endwhile; // end of the loop. ?>
</main>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

0 comments on commit 074cb42

Please sign in to comment.