mirror of
https://github.com/10h30/trestle.git
synced 2026-07-20 07:03:49 +09:00
added textdomain, added ability to change nav menu button text along with default value
This commit is contained in:
@@ -21,6 +21,9 @@ function trestle_theme_setup() {
|
|||||||
define( 'CHILD_THEME_URL', 'http://demo.mightyminnow.com/theme/trestle/' );
|
define( 'CHILD_THEME_URL', 'http://demo.mightyminnow.com/theme/trestle/' );
|
||||||
define( 'CHILD_THEME_VERSION', '1.0' );
|
define( 'CHILD_THEME_VERSION', '1.0' );
|
||||||
|
|
||||||
|
// Load theme text domain
|
||||||
|
load_theme_textdomain( 'trestle', get_template_directory() . '/languages');
|
||||||
|
|
||||||
// Add HTML5 markup structure
|
// Add HTML5 markup structure
|
||||||
add_theme_support( 'html5' );
|
add_theme_support( 'html5' );
|
||||||
|
|
||||||
|
|||||||
+39
-13
@@ -4,31 +4,50 @@
|
|||||||
*
|
*
|
||||||
* Modified from: http://www.billerickson.net/genesis-theme-options/
|
* Modified from: http://www.billerickson.net/genesis-theme-options/
|
||||||
===========================================*/
|
===========================================*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register Defaults
|
* Register Defaults
|
||||||
*
|
*
|
||||||
* @param array $defaults
|
* @param array $defaults
|
||||||
* @return array modified defaults
|
* @return array $defaults updated defaults
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function trestle_custom_defaults( $defaults ) {
|
function trestle_custom_defaults( $defaults ) {
|
||||||
|
|
||||||
$defaults['auto_nav'] = '0';
|
// Trestle default key/value pairs
|
||||||
$defaults['include_home_link'] = '1';
|
$trestle_defaults = array(
|
||||||
$defaults['nav_extras'] = '1';
|
'trestle_auto_nav' => '0',
|
||||||
|
'trestle_include_home_link' => '0',
|
||||||
|
'trestle_nav_button_text' => __( '[icon name="icon-list-ul"] Navigation', 'trestle' ),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Populate Trestle settings with default values if they don't yet exist
|
||||||
|
$options = get_option( GENESIS_SETTINGS_FIELD );
|
||||||
|
foreach ( $trestle_defaults as $k => $v ) {
|
||||||
|
|
||||||
|
// Add defaults to Genesis default settings array
|
||||||
|
$defaults[$k] = $v;
|
||||||
|
|
||||||
|
// Update actual options if they don't yet exist
|
||||||
|
if ( !array_key_exists( $k, $options ) )
|
||||||
|
$options[$k] = $v;
|
||||||
|
|
||||||
|
}
|
||||||
|
update_option( GENESIS_SETTINGS_FIELD, $options );
|
||||||
|
|
||||||
|
// Return modified default array
|
||||||
return $defaults;
|
return $defaults;
|
||||||
}
|
}
|
||||||
add_filter( 'genesis_theme_settings_defaults', 'trestle_custom_defaults' );
|
add_filter( 'genesis_theme_settings_defaults', 'trestle_custom_defaults' );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sanitization
|
* Sanitization
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function trestle_register_social_sanitization_filters() {
|
function trestle_register_social_sanitization_filters() {
|
||||||
|
|
||||||
|
// No HTML
|
||||||
genesis_add_option_filter(
|
genesis_add_option_filter(
|
||||||
'no_html',
|
'no_html',
|
||||||
GENESIS_SETTINGS_FIELD,
|
GENESIS_SETTINGS_FIELD,
|
||||||
@@ -38,11 +57,12 @@ function trestle_register_social_sanitization_filters() {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Safe HTML
|
||||||
genesis_add_option_filter(
|
genesis_add_option_filter(
|
||||||
'safe_html',
|
'safe_html',
|
||||||
GENESIS_SETTINGS_FIELD,
|
GENESIS_SETTINGS_FIELD,
|
||||||
array(
|
array(
|
||||||
'footer_text',
|
'nav_button_text',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -65,6 +85,7 @@ function trestle_register_settings_box( $_genesis_theme_settings_pagehook ) {
|
|||||||
// Call our own custom nav metabox which combines our own settings with Genesis'
|
// Call our own custom nav metabox which combines our own settings with Genesis'
|
||||||
add_meta_box('mm-navigation-settings', __( 'Navigation', 'trestle' ), 'trestle_navigation_settings_box', $_genesis_theme_settings_pagehook, 'main', 'high');
|
add_meta_box('mm-navigation-settings', __( 'Navigation', 'trestle' ), 'trestle_navigation_settings_box', $_genesis_theme_settings_pagehook, 'main', 'high');
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
add_action('genesis_theme_settings_metaboxes', 'trestle_register_settings_box');
|
add_action('genesis_theme_settings_metaboxes', 'trestle_register_settings_box');
|
||||||
|
|
||||||
@@ -76,8 +97,12 @@ function trestle_navigation_settings_box() {
|
|||||||
?>
|
?>
|
||||||
<h4><?php _e( 'Primary Navigation Options', 'trestle' ) ?></h4>
|
<h4><?php _e( 'Primary Navigation Options', 'trestle' ) ?></h4>
|
||||||
<p>
|
<p>
|
||||||
<input type="checkbox" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[auto_nav]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[auto_nav]" value="1" <?php checked( esc_attr( genesis_get_option('auto_nav') ), 1); ?> /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[auto_nav]"><?php _e(' Automatically generate nav menu (replaces custom/manual menu with auto-generated menu)', 'trestle' ); ?></label><br />
|
<input type="checkbox" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_auto_nav]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_auto_nav]" value="1" <?php checked( esc_attr( genesis_get_option('trestle_auto_nav') ), 1); ?> /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_auto_nav]"><?php _e( 'Automatically generate nav menu (replaces custom/manual menu with auto-generated menu)', 'trestle' ); ?></label><br />
|
||||||
<input type="checkbox" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[include_home_link]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[include_home_link]" value="1" <?php checked( esc_attr( genesis_get_option('include_home_link') ), 1); ?> /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[include_home_link]"><?php _e( 'Include Home Link', 'trestle' ); ?></label>
|
<input type="checkbox" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_include_home_link]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_include_home_link]" value="1" <?php checked( esc_attr( genesis_get_option('trestle_include_home_link') ), 1); ?> /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_include_home_link]"><?php _e( 'Include Home Link', 'trestle' ); ?></label>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<?php _e('Text for mobile navigation button (shortcodes can be included):', 'trestle' ); ?></label><br />
|
||||||
|
<input class="widefat" type="text" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_nav_button_text]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_nav_button_text]" value="<?php echo esc_attr( genesis_get_option('trestle_nav_button_text') ); ?>" /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_nav_button_text]">
|
||||||
</p>
|
</p>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
@@ -97,7 +122,8 @@ function trestle_navigation_settings_box() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove placeholder menu if auto-nav is disabled
|
// Remove placeholder menu if auto-nav is disabled
|
||||||
if ( 1 != genesis_get_option( 'auto_nav' ) && wp_get_nav_menu_object( $trestle_nav_title ) && $trestle_nav_title != get_registered_nav_menus()['primary'] )
|
$menus = get_registered_nav_menus();
|
||||||
|
if ( 1 != genesis_get_option( 'auto_nav' ) && wp_get_nav_menu_object( $trestle_nav_title ) && $trestle_nav_title != $menus['primary'] )
|
||||||
wp_delete_nav_menu( $trestle_nav_title );
|
wp_delete_nav_menu( $trestle_nav_title );
|
||||||
|
|
||||||
// Output default Genesis nav options
|
// Output default Genesis nav options
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ function trestle_header_actions() {
|
|||||||
* Admin styles and scripts
|
* Admin styles and scripts
|
||||||
===========================================*/
|
===========================================*/
|
||||||
|
|
||||||
|
// Add admin stylesheet (doesn't yet exist)
|
||||||
function trestle_admin_actions() {
|
function trestle_admin_actions() {
|
||||||
add_editor_style( get_stylesheet_directory_uri() . '/lib/admin/admin.css' );
|
add_editor_style( get_stylesheet_directory_uri() . '/lib/admin/admin.css' );
|
||||||
}
|
}
|
||||||
@@ -192,6 +193,7 @@ function trestle_register_required_plugins() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*===========================================
|
/*===========================================
|
||||||
* Auto & Mobile Navigation
|
* Auto & Mobile Navigation
|
||||||
===========================================*/
|
===========================================*/
|
||||||
@@ -199,7 +201,7 @@ function trestle_register_required_plugins() {
|
|||||||
function trestle_nav_modifications() {
|
function trestle_nav_modifications() {
|
||||||
|
|
||||||
// Auto-generate nav if Genesis theme setting is checked
|
// Auto-generate nav if Genesis theme setting is checked
|
||||||
if ( 1 == genesis_get_option( 'auto_nav' ) ) {
|
if ( 1 == genesis_get_option( 'trestle_auto_nav' ) ) {
|
||||||
|
|
||||||
// Remove existing nav
|
// Remove existing nav
|
||||||
remove_action( 'genesis_after_header', 'genesis_do_nav' );
|
remove_action( 'genesis_after_header', 'genesis_do_nav' );
|
||||||
@@ -209,7 +211,7 @@ function trestle_nav_modifications() {
|
|||||||
|
|
||||||
$args = array(
|
$args = array(
|
||||||
'echo' => false,
|
'echo' => false,
|
||||||
'show_home' => genesis_get_option( 'include_home_link' ),
|
'show_home' => genesis_get_option( 'trestle_include_home_link' ),
|
||||||
'menu_class' => 'auto-menu'
|
'menu_class' => 'auto-menu'
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -257,10 +259,16 @@ function trestle_nav_modifications() {
|
|||||||
|
|
||||||
// Add mobile menu button
|
// Add mobile menu button
|
||||||
function trestle_add_mobile_nav() {
|
function trestle_add_mobile_nav() {
|
||||||
if ( 1 == genesis_get_option( 'auto_nav' ) || has_nav_menu( 'primary' ) )
|
|
||||||
echo '<a id="menu-button" class="button" href="javascript: void(0)"><i class="icon-list-ul"></i> Navigation</a>';
|
// Only add the button if there is a primary menu
|
||||||
|
if ( 1 == genesis_get_option( 'trestle_auto_nav' ) || has_nav_menu( 'primary' ) ) {
|
||||||
|
|
||||||
|
echo '<a id="menu-button" class="button" href="javascript: void(0)">' . do_shortcode( genesis_get_option('trestle_nav_button_text') ) . '</a>';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*===========================================
|
/*===========================================
|
||||||
* Actions & Filters
|
* Actions & Filters
|
||||||
===========================================*/
|
===========================================*/
|
||||||
@@ -271,13 +279,11 @@ function no_jquery( $classes ) {
|
|||||||
return $classes;
|
return $classes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*===========================================
|
/*===========================================
|
||||||
* Footer
|
* Footer
|
||||||
===========================================*/
|
===========================================*/
|
||||||
|
|
||||||
function trestle_custom_footer($output) {
|
function trestle_custom_footer($output) {
|
||||||
return $output . '<p class="mm">[footer_childtheme_link before=""] by <a href="http://mightyminnow.com">MIGHTYminnow</a></p>';
|
return $output . '<p class="mm">[footer_childtheme_link before=""] by <a href="http://mightyminnow.com">MIGHTYminnow</a></p>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================
|
|
||||||
* Shortcodes
|
|
||||||
===========================================*/
|
|
||||||
@@ -6,6 +6,8 @@
|
|||||||
Author: MIGHTYminnow
|
Author: MIGHTYminnow
|
||||||
Author URI: http://www.mightyminnow.com/
|
Author URI: http://www.mightyminnow.com/
|
||||||
Version: 1.0
|
Version: 1.0
|
||||||
|
Tags: genesis, mobile, first, responsive, clean, black, orange, white, one-column, two-columns, three-columns, left-sidebar, right-sidebar, fixed-width, custom-menu, full-width-template, rtl-language-support, sticky-post, theme-options, threaded-comments, translation-ready
|
||||||
|
Text Domain: trestle;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Table of Contents
|
/* Table of Contents
|
||||||
@@ -277,13 +279,13 @@ h6 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
font-size: 36px;
|
font-size: 28px;
|
||||||
font-size: 3.6rem;
|
font-size: 2.8rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
font-size: 30px;
|
font-size: 24px;
|
||||||
font-size: 3rem;
|
font-size: 2.4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.entry-content h2 {
|
.entry-content h2 {
|
||||||
@@ -291,20 +293,20 @@ h2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
h3 {
|
h3 {
|
||||||
font-size: 24px;
|
|
||||||
font-size: 2.4rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
h4 {
|
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
font-size: 2rem;
|
font-size: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
h5 {
|
h4 {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
font-size: 1.8rem;
|
font-size: 1.8rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h5 {
|
||||||
|
font-size: 16px;
|
||||||
|
font-size: 1.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
h6 {
|
h6 {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-size: 1.6rem;
|
font-size: 1.6rem;
|
||||||
@@ -421,7 +423,7 @@ input:hover[type="submit"],
|
|||||||
}
|
}
|
||||||
|
|
||||||
.arrow-left:before {
|
.arrow-left:before {
|
||||||
content: "\f0a9\00a0\00a0";
|
content: "\f0a8\00a0\00a0";
|
||||||
font-family: FontAwesome;
|
font-family: FontAwesome;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -705,8 +707,6 @@ img.alignright,
|
|||||||
--------------------------------------------- */
|
--------------------------------------------- */
|
||||||
|
|
||||||
.entry-title {
|
.entry-title {
|
||||||
font-size: 36px;
|
|
||||||
font-size: 3.6rem;
|
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1545,7 +1545,41 @@ Media Queries
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media only screen and (min-width: 768px) {
|
@media only screen and (min-width: 480px) {
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 36px;
|
||||||
|
font-size: 3.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-size: 30px;
|
||||||
|
font-size: 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
font-size: 24px;
|
||||||
|
font-size: 2.4rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h4 {
|
||||||
|
font-size: 20px;
|
||||||
|
font-size: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h5 {
|
||||||
|
font-size: 18px;
|
||||||
|
font-size: 1.8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h6 {
|
||||||
|
font-size: 16px;
|
||||||
|
font-size: 1.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background-color: #f5f5f5;
|
background-color: #f5f5f5;
|
||||||
|
|||||||
Reference in New Issue
Block a user