76 Commits

Author SHA1 Message Date
Braad Martin 81b17fd9b7 Add RICG Responsive Images to our recommended plugins list 2015-06-30 20:53:35 -07:00
Braad Martin 3e6432dc8d Add a mime type check, add an extra check on post revision number, and cleanup formatting 2015-06-30 20:37:00 -07:00
Braad Martin 8cd6b7ae9b Switch to storing logos by image ID and outputting them properly 2015-06-30 20:19:35 -07:00
Braad Martin 05448fdd0f Bump version number 2015-06-30 20:10:36 -07:00
Mickey Kay 2950acb3b6 Merge pull request #29 from BraadMartin/move-bfal-require
Move BFAL require to allow plugin's copy of the BFAL class to load first
2015-06-24 15:27:22 -07:00
Braad e437b1dd68 Use trailingslashit() 2015-06-23 16:56:54 -07:00
Braad 4341f49977 Move BFAL require to allow plugin's files the change to load first 2015-06-23 16:54:05 -07:00
Braad 4a763ee628 Merge pull request #15 from BraadMartin/dev
Add post-id-xx or page-id-xx class to TinyMCE previews on post/page edit screens
2015-06-23 12:32:55 -07:00
Braad 2199c0709a Update @since to 2.2.0 2015-06-23 12:32:11 -07:00
Mickey Kay 786b246206 Merge pull request #26 from BraadMartin/post-classes
Introduce trestle_post_classes to add custom classes to posts
2015-06-23 09:38:00 -07:00
Braad 77deddd2b8 Introduce trestle_post_classes to add custom classes to posts in certain situations 2015-06-22 13:14:21 -07:00
MickeyKay e1090a9de7 Remove unused button classes. Fixes #25. 2015-06-10 13:53:31 -07:00
MickeyKay d8ea929b16 Undo 1px media query bumps per #24. 2015-06-09 15:37:39 -07:00
MickeyKay f43864af2d Bump all min-width media queries by 1px. Fixes #24. 2015-06-09 15:09:25 -07:00
MickeyKay ddef43a7a5 Fix whitespace. 2015-06-08 17:08:35 -07:00
MickeyKay 6460223c7f Add Font Awesome optimization styles for all icon outputs in stylesheet. Fixes #18. 2015-06-08 17:05:16 -07:00
MickeyKay 02feca7265 Merge branch 'dev' of https://github.com/MIGHTYminnow/trestle into dev 2015-06-08 17:00:17 -07:00
MickeyKay c8b594d747 Remove extract() calls from shortcodes. Fixes #16. 2015-06-08 17:00:11 -07:00
MickeyKay 48a83ba64a Remove extract() calls from shortcodes. 2015-06-08 16:58:15 -07:00
MickeyKay f87fc1e50e Merge branch 'dev' of https://github.com/MIGHTYminnow/trestle into dev 2015-06-08 16:44:25 -07:00
MickeyKay d369ef6853 Update TGM Plugin Class list. Fixes #23. 2015-06-08 16:43:53 -07:00
MickeyKay 2faea53445 Update TGM Plugin Activation class recommened/required plugins list. 2015-06-08 16:41:26 -07:00
MickeyKay df35ff6560 Update TGM Plugin Activation class to version 2.4.2 2015-06-08 16:31:28 -07:00
MickeyKay d8d22e6def Fix missing /lib folder. 2015-06-08 16:18:52 -07:00
MickeyKay 7a5acbbe9a Move TGM Plugin Activation class into /lib and correct include paths for TGM and utilities.php 2015-06-08 16:15:52 -07:00
MickeyKay 88a3261cfd Update utilities.php location, include, and header. 2015-06-08 16:08:48 -07:00
Mickey Kay 7e5e7b03dc Merge pull request #22 from BraadMartin/trestle-log
Add new utilities.php and a custom logging function
2015-06-08 16:06:16 -07:00
Braad e45223311a Add new utilities.php with a custom logging function 2015-06-02 14:05:59 -07:00
Mickey Kay ed20653fbb Merge pull request #19 from BraadMartin/move-css
Move CSS enqueue to a later hook to come after plugins
2015-06-01 11:38:25 -07:00
Braad 68aa66d549 Move CSS enqueue to a later hook to come after plugins 2015-06-01 11:29:37 -07:00
Braad 119078fc26 Add post-id-xx or page-id-xx class to TinyMCE previews 2015-05-27 14:38:05 -07:00
Braad 03de45dadd Switch to using var to avoid hitting the DOM 2015-05-22 12:41:35 -07:00
Braad 851f5ff19d Move CSS for toggle buttons to a better selector 2015-05-22 12:35:34 -07:00
Braad 54eb9ab02c Add option for mobile nav toggle style 2015-05-22 12:19:57 -07:00
Braad 4b85568883 Set font-smoothing property for better font rendering in the editor 2015-05-20 11:09:51 -07:00
Braad Martin 7ec25a1c8d Bump the version number to 2.0.1 2015-05-19 20:25:55 -07:00
Braad ea717c00ff Include Lato in the editor 2015-05-14 00:58:14 -07:00
Braad 7ffeb0c85f Fix margins on content in the editor 2015-05-14 00:47:36 -07:00
Braad 9d30ddbed5 Fix BFA paths
- Introduce setup_root_url() from latest version of the Better Font Awesome Library
- Switch to using new root_url var in place of plugins_url()
- This fixes issue #13
2015-05-14 00:32:22 -07:00
MickeyKay 94f2276f7e Remove test comment. 2015-05-12 13:57:21 -07:00
MickeyKay 7e994c85e8 Merge branch 'master' of https://github.com/MIGHTYminnow/trestle 2015-05-12 13:56:44 -07:00
MickeyKay 86e64b007c Test comment 2015-05-12 13:56:17 -07:00
Mickey Kay 00be1d2046 Merge pull request #12 from BraadMartin/master
Fix for jQuery UI datepicker CSS issue
2015-05-12 13:34:46 -07:00
Braad f24364e114 Fix for jQuery UI datepicker CSS issue 2015-05-12 12:38:03 -07:00
MickeyKay 65d0ea44a6 Update README.md. 2015-05-11 17:18:36 -07:00
MickeyKay d6115d0fae Update README.md. 2015-05-11 17:18:02 -07:00
MickeyKay 880e8c6f50 Bump version to 2.0.0! Woot! 2015-05-11 17:17:19 -07:00
MickeyKay dfe92cbbf3 Fix merge conflict. 2015-05-11 17:16:18 -07:00
MickeyKay 2b989d7424 Fix merge conflict. 2015-05-11 17:15:53 -07:00
MickeyKay 8a6adb7400 Fix whitespace. 2015-05-11 17:13:51 -07:00
MickeyKay 7e666d0bb9 Fixed merge conflicts from feature/trestle-settings. 2015-05-11 17:11:29 -07:00
MickeyKay 1bb6537455 Complete switch over to Trestle settings. 2015-05-11 17:09:22 -07:00
MickeyKay c7055b91ac Merge branch 'dev' of github.com:MickeyKay/trestle into dev 2015-04-30 16:12:35 -07:00
MickeyKay 67996d4e70 Fix whitespace. 2015-04-30 16:11:39 -07:00
Braad 7d1b5573a1 Fix control name for search_in_nav 2015-04-30 15:11:54 -07:00
Braad 3dae9f0443 Formatting 2015-04-30 14:52:22 -07:00
Braad c8667ce065 Better sanitization of options in the Customizer, other fixes 2015-04-30 14:49:46 -07:00
Braad 335594dbd2 Fix saving of default options 2015-04-30 13:00:21 -07:00
Braad d77a0a7440 First pass at switching to trestle-settings and some inline documentation cleanup 2015-04-30 12:24:30 -07:00
Mickey Kay 1b8e9a7e43 Merge pull request #8 from BraadMartin/dev
Fix bug in the [date] shortcode and improve formatting
2015-04-30 10:11:31 -07:00
Braad 39a1e729dd Fix bug in the date shortcode and minor formatting improvements to shortcodes.php 2015-04-29 14:06:10 -07:00
Braad 051fdfb0d1 Fix bug in the date shortcode and minor formatting improvements to shortcodes.php 2015-04-29 13:48:50 -07:00
Braad 6d34078f94 Syncing with dev branch 2015-04-21 12:05:22 -07:00
MickeyKay f8bd7fc700 Add equal height columns to plugin list. 2015-04-03 09:39:36 -07:00
MickeyKay 0b06acc857 Switch recommended FancyBox plugin. 2015-03-31 12:24:48 -07:00
MickeyKay 6abe714a1e Merge dev-test branch. 2015-03-23 15:49:05 -07:00
MickeyKay ade79de867 Update responsive header/full menu behavior. 2015-03-23 15:47:56 -07:00
MickeyKay 8a097c4be2 Fix mobile nav CSS and jQuery 2015-03-23 13:32:00 -07:00
MickeyKay c8861270e1 Remove nav functionality that now lives in Auto Menu From Pages plugin. 2015-03-23 12:53:21 -07:00
MickeyKay 189b5fe995 Re-add favicon functionality. 2015-03-23 12:33:33 -07:00
MickeyKay 8890f6e413 Fix merge conflict causing PHP error. 2015-03-23 12:19:09 -07:00
MickeyKay 58a3cd2f26 Merge branch 'BraadMartin-dev' into dev-test 2015-03-23 12:17:17 -07:00
MickeyKay eac35762fe Update styles to include better input styleing. 2015-02-19 14:52:32 -08:00
Mickey Kay b0506281e8 Update README.md 2014-12-18 10:02:48 -08:00
Mickey Kay eae7e220d9 Update README.md 2014-12-18 09:36:55 -08:00
Mickey Kay 1ebd6ff5df Update README.md 2014-12-18 09:36:00 -08:00
14 changed files with 3173 additions and 3042 deletions
+3 -20
View File
@@ -1,5 +1,5 @@
Trestle
=======
---------------------
### A handy boilerplate child theme for serious Genesis developers.
[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/MickeyKay/trestle?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
@@ -25,22 +25,5 @@ Here are some of Trestle's many features, check out the [Trestle Demo](http://de
* And more!
#### Settings & Usage
* The Trestle control panel is located at **Genesis → Theme Settings**, in the **Trestle** metabox.
* Examples and usage can all be viewed on the [Trestle Demo](http://demo.mightyminnow.com/theme/trestle/)
#### To Do
* Add ability to click off of mobile menu/search to hide menu/search.
* Rework menu CSS for simplicity (general / primary / secondary / header)
* Convert non-theme functionality to separate Genesis-dependant plugin
* Add in Grunt support for:
* Sass
* Auto-ordering of CSS (CSSComb)
* Translation
* Check other themes for other ideas. . .
* Switch to customizer for theme options instead of Genesis panel (pros? cons?)
* Remove custom background CSS that doesn't make sense (different max-widths, etc)
* Weird extra icons on accordions on demo site.
* Add checkbox to control author box (along with post info/meta) output (see ES: esw-custom.php)
* Mobile menu button setting - either:
* Remove (currently controlled from JS), or
* Pass icon/text as params to jQuery
* All Trestle settings can be accessed via the **Customizer**.
* Examples and usage can all be viewed on the [Trestle Demo](http://demo.mightyminnow.com/theme/trestle/)
+21 -26
View File
@@ -1,7 +1,7 @@
<?php
/**
* Theme functionality
* Theme functionality.
*
* @since 1.0.0
*
@@ -12,31 +12,31 @@
* Required Files
===========================================*/
// Theme functions
// Theme functions.
require_once dirname( __FILE__ ) . '/includes/functions/theme-functions.php';
// Admin functionality
// Admin functionality.
require_once dirname( __FILE__ ) . '/includes/admin/admin.php';
// Customizer controls
// Customizer controls.
require_once dirname( __FILE__ ) . '/includes/admin/customizer.php';
// Shortcodes
// Shortcodes.
require_once dirname( __FILE__ ) . '/includes/shortcodes/shortcodes.php';
// Additional sidebars
// Additional sidebars.
require_once dirname( __FILE__ ) . '/includes/widget-areas/widget-areas.php';
// Plugin activation class
require_once dirname( __FILE__ ) . '/includes/classes/class-tgm-plugin-activation.php';
// Plugin activation class.
require_once dirname( __FILE__ ) . '/lib/class-tgm-plugin-activation.php';
// Better Font Awesome Library
require_once dirname( __FILE__ ) . '/lib/better-font-awesome-library/better-font-awesome-library.php';
// Dev utility functions.
require_once dirname( __FILE__ ) . '/includes/utilities/utilities.php';
add_action( 'genesis_setup' ,'trestle_theme_setup', 15 );
add_action( 'genesis_setup', 'trestle_theme_setup', 15 );
/**
* Initialize Trestle
* Initialize Trestle.
*
* @since 1.0.0
*/
@@ -46,21 +46,16 @@ function trestle_theme_setup() {
* Theme Setup
===========================================*/
// Child theme definitions (do not remove)
define( 'CHILD_THEME_NAME', 'Trestle' );
define( 'CHILD_THEME_URL', 'http://demo.mightyminnow.com/theme/trestle/' );
define( 'CHILD_THEME_VERSION', '1.2.0' );
// Child theme definitions (do not remove).
define( 'TRESTLE_THEME_NAME', 'Trestle' );
define( 'TRESTLE_THEME_URL', 'http://demo.mightyminnow.com/theme/trestle/' );
define( 'TRESTLE_THEME_VERSION', '2.1.0' );
define( 'TRESTLE_SETTINGS_FIELD', 'trestle-settings' );
// Load theme text domain
// Setup default theme settings.
trestle_settings_defaults();
// Load theme text domain.
load_theme_textdomain( 'trestle', get_stylesheet_directory() . '/languages' );
// Add HTML5 markup structure
add_theme_support( 'html5' );
// Add viewport meta tag for mobile browsers
add_theme_support( 'genesis-responsive-viewport' );
// Add support for footer widgets if specified in Trestle settings
$trestle_footer_widgets_number = esc_attr( genesis_get_option( 'trestle_footer_widgets_number' ) );
add_theme_support( 'genesis-footer-widgets', $trestle_footer_widgets_number );
}
Regular → Executable
+108 -75
View File
@@ -7,6 +7,77 @@
* @package Trestle
*/
/**
* Set up Trestle default settings.
*
* @since 2.0.0
*
* @return array Genesis settings updated to include Trestle defaults.
*/
function trestle_settings_defaults() {
// Trestle default key/value pairs.
$trestle_defaults = array(
'layout' => 'solid',
'logo_id' => '',
'logo_id_mobile' => '',
'favicon_url' => '',
'nav_primary_location' => 'full',
'mobile_nav_toggle' => 'small-icon',
'search_in_nav' => '',
'read_more_text' => __( 'Read&nbsp;More&nbsp;&raquo;', 'trestle' ),
'revisions_number' => 3,
'footer_widgets_number' => 3,
'external_link_icons' => 0,
'email_link_icons' => 0,
'pdf_link_icons' => 0,
'doc_link_icons' => 0,
);
// Populate Trestle settings with default values if they don't yet exist.
$options = get_option( TRESTLE_SETTINGS_FIELD );
// Set up an empty array if we're running for the first time.
if ( ! $options ) {
$options = array();
}
// Bail early if the settings match the defaults.
if ( $options === $trestle_defaults ) {
return;
}
// Populate any defaults that are missing.
foreach ( $trestle_defaults as $k => $v ) {
// Check each key to only add the missing settings.
if ( ! array_key_exists( $k, $options ) ) {
$options[$k] = $v;
}
}
// Update options with defaults.
update_option( TRESTLE_SETTINGS_FIELD, $options );
}
/**
* Wrapper function to get Trestle options.
*
* @since 2.0.0
* @uses genesis_get_option()
*
* @return mixed Trestle option value.
*/
function trestle_get_option( $key, $setting = null, $use_cache = true ) {
// Set default to TRESTLE_SETTINGS_FIELD.
$setting = $setting ? $setting : TRESTLE_SETTINGS_FIELD;
return genesis_get_option( $key, $setting, false );
}
add_action( 'admin_enqueue_scripts', 'trestle_admin_actions' );
/**
* Loads admin scripts and styles.
@@ -15,49 +86,40 @@ add_action( 'admin_enqueue_scripts', 'trestle_admin_actions' );
*/
function trestle_admin_actions() {
// Include the main stylesheet in the editor
// Google fonts.
$font_url = str_replace( ',', '%2C', '//fonts.googleapis.com/css?family=Lato:300,400,700' );
add_editor_style( $font_url );
// Include the main stylesheet in the editor.
add_editor_style( get_stylesheet_uri() );
}
add_filter( 'genesis_theme_settings_defaults', 'trestle_custom_defaults' );
add_filter( 'tiny_mce_before_init', 'trestle_tiny_mce_before_init' );
/**
* Sets up Trestle default settings.
* Add custom classes to the body of TinyMCE previews.
*
* @since 1.0.0
*
* @param array $defaults Genesis default settings.
* @return array Genesis settings updated to include Trestle defaults.
* @since 2.2.0
*/
function trestle_custom_defaults( $defaults ) {
function trestle_tiny_mce_before_init( $init_array ) {
// Trestle default key/value pairs
$trestle_defaults = array(
'trestle_layout' => 'solid',
'trestle_logo_url' => '',
'trestle_logo_url_mobile' => '',
'trestle_nav_primary_location' => 'full',
'trestle_read_more_text' => __( 'Read&nbsp;More&nbsp;&raquo;', 'trestle' ),
'trestle_revisions_number' => 3,
'trestle_footer_widgets_number' => 3,
);
global $post;
// Populate Trestle settings with default values if they don't yet exist
$options = get_option( GENESIS_SETTINGS_FIELD );
$screen = get_current_screen();
foreach ( $trestle_defaults as $k => $v ) {
// If we're on an edit screen, add an appropriate 'post-id-XX' or 'page-id-XX'.
if ( 'edit' == $screen->parent_base ) {
// Add defaults to Genesis default settings array
$defaults[$k] = $v;
// Custom post types always use 'post', so we only need to handle pages.
$post_type = ( 'page' == $post->post_type ) ? 'page' : 'post';
// Update actual options if they don't yet exist
if ( $options && ! array_key_exists( $k, $options ) )
$options[$k] = $v;
$init_array['body_class'] .= sprintf( ' %s-id-%s',
$post_type,
$post->ID
);
}
// Update options with defaults
update_option( GENESIS_SETTINGS_FIELD, $options );
return $defaults;
return $init_array;
}
add_action( 'tgmpa_register', 'trestle_register_required_plugins' );
@@ -95,8 +157,14 @@ function trestle_register_required_plugins() {
),
array(
'name' => 'Events Manager',
'slug' => 'events-manager',
'name' => 'Easy FancyBox',
'slug' => 'easy-fancybox',
'required' => false,
),
array(
'name' => 'Equal Height Columns',
'slug' => 'equal-height-columns',
'required' => false,
),
@@ -106,24 +174,6 @@ function trestle_register_required_plugins() {
'required' => false,
),
array(
'name' => 'Facebook Open Graph Meta Tags for WordPress',
'slug' => 'wonderm00ns-simple-facebook-open-graph-tags',
'required' => false,
),
array(
'name' => 'FancyBox for WordPress',
'slug' => 'fancybox-for-wordpress',
'required' => false,
),
array(
'name' => 'Genesis Featured Widget Amplified',
'slug' => 'genesis-featured-widget-amplified',
'required' => false,
),
array(
'name' => 'Genesis Simple Edits',
'slug' => 'genesis-simple-edits',
@@ -136,30 +186,12 @@ function trestle_register_required_plugins() {
'required' => false,
),
array(
'name' => 'Jetpack by WordPress.com',
'slug' => 'jetpack',
'required' => false,
),
array(
'name' => 'MapPress Easy Google Maps',
'slug' => 'mappress-google-maps-for-wordpress',
'required' => false,
),
array(
'name' => 'My Page Order',
'slug' => 'my-page-order',
'required' => false,
),
array(
'name' => 'NextGen Gallery',
'slug' => 'nextgen-gallery',
'required' => false,
),
array(
'name' => 'Post Thumbnail Editor',
'slug' => 'post-thumbnail-editor',
@@ -179,8 +211,8 @@ function trestle_register_required_plugins() {
),
array(
'name' => 'Social Media Widget',
'slug' => 'social-media-widget',
'name' => 'RICG Responsive Images',
'slug' => 'ricg-responsive-images',
'required' => false,
),
@@ -209,14 +241,15 @@ function trestle_register_required_plugins() {
),
array(
'name' => 'WP Hotkeys',
'slug' => 'wp-hotkeys',
'name' => 'WordPress SEO by Yoast',
'slug' => 'wordpress-seo',
'required' => false,
),
);
// Change this to your theme text domain, used for internationalising strings
$theme_text_domain = 'mightyminnow';
// Change this to your theme text domain, used for internationalising strings.
$theme_text_domain = 'trestle';
/**
* Array of configuration settings. Amend each line as needed.
@@ -257,4 +290,4 @@ function trestle_register_required_plugins() {
);
tgmpa( $plugins, $config );
}
}
-137
View File
@@ -1,137 +0,0 @@
/**
* JavaScript for the Customizer Preview
*
* @since 1.0.0
*/
( function( $ ) {
// Layout
wp.customize( 'genesis-settings[trestle_layout]', function( value ) {
value.bind( function( value ) {
var $body = $( 'body' );
switch ( value ) {
case 'solid':
$body.removeClass( 'bubble' );
break;
case 'bubble':
$body.addClass( 'bubble' );
break;
}
});
});
// Custom logo
wp.customize( 'genesis-settings[trestle_logo_url]', function( value ) {
value.bind( function( url ) {
var $body = $( 'body' );
if ( 0 === $.trim( url ).length ) {
$body.removeClass( 'has-logo' );
$( '.site-title a.image-link' ).remove();
} else {
$body.addClass( 'has-logo' );
$( '.site-title a.image-link' ).remove();
$( '.site-title' ).append( '<a href="/" class="image-link"><img class="logo logo-full show" src="' + url + '" /></a>' );
}
});
});
// Primary Nav Location
wp.customize( 'genesis-settings[trestle_nav_primary_location]', function( value ) {
value.bind( function( value ) {
var $body = $( 'body' );
var $nav = $( '.nav-primary' );
switch ( value ) {
case 'full':
$body.removeClass( 'nav-primary-location-header' )
.addClass( 'nav-primary-location-full' );
$nav.remove().insertAfter( '.site-header' );
break;
case 'header':
$body.removeClass( 'nav-primary-location-full' )
.addClass( 'nav-primary-location-header' );
$nav.remove().appendTo( '.site-header .wrap' );
break;
}
});
});
// Custom Read More Link Text
wp.customize( 'genesis-settings[trestle_read_more_text]', function( value ) {
value.bind( function( value ) {
$( 'a.more-link' ).text( value );
});
});
// External Links
wp.customize( 'genesis-settings[trestle_external_link_icons]', function( value ) {
value.bind( function( value ) {
var $body = $( 'body' );
if ( value ) {
$body.addClass( 'external-link-icons' );
} else {
$body.removeClass( 'external-link-icons' );
}
});
});
// Email Links
wp.customize( 'genesis-settings[trestle_email_link_icons]', function( value ) {
value.bind( function( value ) {
var $body = $( 'body' );
if ( value ) {
$body.addClass( 'email-link-icons' );
} else {
$body.removeClass( 'email-link-icons' );
}
});
});
// PDF Links
wp.customize( 'genesis-settings[trestle_pdf_link_icons]', function( value ) {
value.bind( function( value ) {
var $body = $( 'body' );
if ( value ) {
$body.addClass( 'pdf-link-icons' );
} else {
$body.removeClass( 'pdf-link-icons' );
}
});
});
// Doc Links
wp.customize( 'genesis-settings[trestle_doc_link_icons]', function( value ) {
value.bind( function( value ) {
var $body = $( 'body' );
if ( value ) {
$body.addClass( 'doc-link-icons' );
} else {
$body.removeClass( 'doc-link-icons' );
}
});
});
})( jQuery );
Regular → Executable
+267 -227
View File
@@ -1,323 +1,363 @@
<?php
/**
* Trestle Customizer Controls
* Trestle Customizer Controls.
*
* @since 1.0.0
* @since 2.0.0
*
* @package Trestle
*/
add_action( 'customize_preview_init', 'trestle_customizer_preview_js' );
/**
* Enqueue scripts for the site preview iframe on the customizer screen
*
* @since 1.0.0
*/
function trestle_customizer_preview_js() {
wp_enqueue_script(
'trestle_customizer',
get_stylesheet_directory_uri() . '/includes/admin/customizer.js',
array( 'jquery', 'customize-preview' ), // Dependencies
null, // Version
true // Load in Footer
);
}
add_action( 'customize_register', 'trestle_customizer_controls' );
/**
* Register Trestle's controls
* Register Trestle's controls.
*
* @since 1.0.0
* @since 2.0.0
*
* @param $wp_customize The Customizer Object
* @param $wp_customize The Customizer Object.
*/
function trestle_customizer_controls( $wp_customize ) {
/**
* Trestle Settings Section
* Trestle Settings Section.
*/
// Add the section
// Add the section.
$wp_customize->add_section(
'trestle_settings_section',
array(
'title' => __( 'Trestle Settings', 'trestle' ),
'priority' => 160,
'title' => __( 'Trestle Settings', 'trestle' ),
'priority' => 160,
)
);
// Layout
// Layout.
$wp_customize->add_setting(
'genesis-settings[trestle_layout]',
'trestle-settings[layout]',
array(
'default' => '',
'type' => 'option',
'transport' => 'postMessage',
'capability' => 'edit_theme_options',
'default' => trestle_get_option( 'layout' ),
'type' => 'option',
'capability' => 'edit_theme_options',
)
);
$wp_customize->add_control(
'trestle_layout_control',
array(
'section' => 'trestle_settings_section',
'settings' => 'genesis-settings[trestle_layout]',
'label' => __( 'Layout', 'trestle' ),
'type' => 'radio',
'choices' => array(
'bubble' => __( 'Bubble', 'trestle' ),
'solid' => __( 'Solid', 'trestle' ),
)
)
);
// Upload a logo
$wp_customize->add_setting(
'genesis-settings[trestle_logo_url]',
array(
'default' => genesis_get_option( 'trestle_logo_url' ),
'type' => 'option',
'transport' => 'postMessage',
'capability' => 'edit_theme_options',
)
);
$wp_customize->add_control(
new WP_Customize_Image_Control(
$wp_customize,
'trestle_logo_control',
array(
'label' => __( 'Upload a logo', 'trestle' ),
'section' => 'trestle_settings_section',
'settings' => 'genesis-settings[trestle_logo_url]',
)
)
);
// Upload a mobile logo
$wp_customize->add_setting(
'genesis-settings[trestle_logo_url_mobile]',
array(
'default' => genesis_get_option( 'trestle_logo_url_mobile' ),
'type' => 'option',
'transport' => 'postMessage',
'capability' => 'edit_theme_options',
)
);
$wp_customize->add_control(
new WP_Customize_Image_Control(
$wp_customize,
'trestle_mobile_logo_control',
array(
'label' => __( 'Upload a logo for mobile', 'trestle' ),
'section' => 'trestle_settings_section',
'settings' => 'genesis-settings[trestle_logo_url_mobile]',
)
)
);
// Primary nav style
$wp_customize->add_setting(
'genesis-settings[trestle_nav_primary_location]',
'trestle_layout_control',
array(
'default' => genesis_get_option( 'trestle_nav_primary_location' ),
'type' => 'option',
'transport' => 'postMessage',
'capability' => 'edit_theme_options',
'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[layout]',
'label' => __( 'Layout', 'trestle' ),
'type' => 'radio',
'choices' => array(
'bubble' => __( 'Bubble', 'trestle' ),
'solid' => __( 'Solid', 'trestle' ),
)
)
);
// Upload a logo.
$wp_customize->add_setting(
'trestle-settings[logo_id]',
array(
'default' => trestle_get_option( 'logo_id' ),
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
'trestle_nav_primary_location_control',
array(
'section' => 'trestle_settings_section',
'settings' => 'genesis-settings[trestle_nav_primary_location]',
'label' => __( 'Menu style', 'trestle' ),
'type' => 'select',
'choices' => array(
'full' => __( 'Full Width', 'trestle' ),
'header' => __( 'Header Right', 'trestle' ),
)
)
);
new WP_Customize_Media_Control(
$wp_customize,
'trestle_logo_control',
array(
'label' => __( 'Upload a logo', 'trestle' ),
'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[logo_id]',
'mime_type' => 'image',
)
)
);
// Blog post custom read more link text
$wp_customize->add_setting(
'genesis-settings[trestle_read_more_text]',
// Upload a mobile logo.
$wp_customize->add_setting(
'trestle-settings[logo_id_mobile]',
array(
'default' => genesis_get_option( 'trestle_read_more_text' ),
'type' => 'option',
'transport' => 'postMessage',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'wp_kses_post',
'default' => trestle_get_option( 'logo_id_mobile' ),
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
'trestle_read_more_text_control',
array(
'section' => 'trestle_settings_section',
'settings' => 'genesis-settings[trestle_read_more_text]',
'label' => __( 'Custom read more link text', 'trestle' ),
)
);
new WP_Customize_Media_Control(
$wp_customize,
'trestle_mobile_logo_control',
array(
'label' => __( 'Upload a mobile logo', 'trestle' ),
'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[logo_id_mobile]',
'mime_type' => 'image',
)
)
);
// Post revisions number
$wp_customize->add_setting(
'genesis-settings[trestle_revisions_number]',
// Upload a mobile logo.
$wp_customize->add_setting(
'trestle-settings[favicon_url]',
array(
'default' => genesis_get_option( 'trestle_revisions_number' ),
'type' => 'option',
'transport' => 'postMessage',
'capability' => 'edit_theme_options',
'default' => trestle_get_option( 'favicon_url' ),
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'esc_url_raw',
)
);
$wp_customize->add_control(
'trestle_revisions_number_control',
array(
'section' => 'trestle_settings_section',
'settings' => 'genesis-settings[trestle_revisions_number]',
'label' => __( 'Number of post revisions', 'trestle' ),
'type' => 'select',
'choices' => array(
'-1' => __( 'Unlimited', 'trestle' ),
'0' => '0',
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5',
'6' => '6',
'7' => '7',
'8' => '8',
'9' => '9',
'10' => '10',
)
)
);
new WP_Customize_Image_Control(
$wp_customize,
'trestle_favicon_control',
array(
'label' => __( 'Upload a favicon', 'trestle' ),
'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[favicon_url]',
)
)
);
// Footer Widget Areas
$wp_customize->add_setting(
'genesis-settings[trestle_footer_widgets_number]',
// Primary nav style.
$wp_customize->add_setting(
'trestle-settings[nav_primary_location]',
array(
'default' => genesis_get_option( 'trestle_footer_widgets_number' ),
'type' => 'option',
'transport' => 'postMessage',
'capability' => 'edit_theme_options',
'default' => trestle_get_option( 'nav_primary_location' ),
'type' => 'option',
'capability' => 'edit_theme_options',
)
);
$wp_customize->add_control(
'trestle_footer_widgets_number_control',
array(
'section' => 'trestle_settings_section',
'settings' => 'genesis-settings[trestle_footer_widgets_number]',
'label' => __( 'Number of footer widgets', 'trestle' ),
'type' => 'select',
'choices' => array(
'0' => '0',
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5',
'6' => '6',
)
)
);
// Add a label for the link icons
$wp_customize->add_setting(
'genesis-settings[trestle_link_icons_title]',
'trestle_nav_primary_location_control',
array(
'default' => '',
'type' => 'option',
'capability' => 'edit_theme_options',
'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[nav_primary_location]',
'label' => __( 'Menu style', 'trestle' ),
'type' => 'select',
'choices' => array(
'full' => __( 'Full Width', 'trestle' ),
'header' => __( 'Header Right', 'trestle' ),
)
)
);
// Mobile nav toggle.
$wp_customize->add_setting(
'trestle-settings[mobile_nav_toggle]',
array(
'default' => trestle_get_option( 'mobile_nav_toggle' ),
'type' => 'option',
'capability' => 'edit_theme_options',
)
);
$wp_customize->add_control(
'trestle_mobile_nav_toggle_control',
array(
'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[mobile_nav_toggle]',
'label' => __( 'Mobile Menu Toggle', 'trestle' ),
'type' => 'select',
'choices' => array(
'small-icon' => __( 'Small Icon', 'trestle' ),
'big-button' => __( 'Big Button', 'trestle' ),
)
)
);
// Primary nav extras.
$wp_customize->add_setting(
'trestle-settings[search_in_nav]',
array(
'default' => trestle_get_option( 'search_in_nav' ),
'type' => 'option',
'capability' => 'edit_theme_options',
)
);
$wp_customize->add_control(
'trestle_search_in_nav_control',
array(
'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[search_in_nav]',
'label' => __( 'Add search to mobile navigation', 'trestle' ),
'type' => 'checkbox',
)
);
// Blog post custom read more link text.
$wp_customize->add_setting(
'trestle-settings[read_more_text]',
array(
'default' => trestle_get_option( 'read_more_text' ),
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'wp_kses_post',
)
);
$wp_customize->add_control(
'trestle_read_more_text_control',
array(
'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[read_more_text]',
'label' => __( 'Custom read more link text', 'trestle' ),
)
);
// Post revisions number.
$wp_customize->add_setting(
'trestle-settings[revisions_number]',
array(
'default' => trestle_get_option( 'revisions_number' ),
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
'trestle_revisions_number_control',
array(
'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[revisions_number]',
'label' => __( 'Number of post revisions', 'trestle' ),
'type' => 'select',
'choices' => array(
'-1' => __( 'Unlimited', 'trestle' ),
'0' => '0',
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5',
'6' => '6',
'7' => '7',
'8' => '8',
'9' => '9',
'10' => '10',
)
)
);
// Footer Widget Areas.
$wp_customize->add_setting(
'trestle-settings[footer_widgets_number]',
array(
'default' => trestle_get_option( 'footer_widgets_number' ),
'type' => 'option',
'capability' => 'edit_theme_options',
)
);
$wp_customize->add_control(
'trestle_footer_widgets_number_control',
array(
'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[footer_widgets_number]',
'label' => __( 'Number of footer widgets', 'trestle' ),
'type' => 'select',
'choices' => array(
'0' => '0',
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5',
'6' => '6',
)
)
);
// Add a label for the link icons.
$wp_customize->add_setting(
'trestle-settings[link_icons_title]',
array(
'default' => '',
'type' => 'option',
)
);
$wp_customize->add_control(
'trestle_link_icons_title',
array(
'section' => 'trestle_settings_section',
'settings' => 'genesis-settings[trestle_link_icons_title]',
'label' => __( 'Icon links', 'trestle' ),
'type' => 'hidden',
'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[link_icons_title]',
'label' => __( 'Icon links', 'trestle' ),
'type' => 'hidden',
)
);
// External Link Icons
// External Link Icons.
$wp_customize->add_setting(
'genesis-settings[trestle_external_link_icons]',
'trestle-settings[external_link_icons]',
array(
'default' => genesis_get_option( 'trestle_external_link_icons' ),
'type' => 'option',
'transport' => 'postMessage',
'capability' => 'edit_theme_options',
'default' => trestle_get_option( 'external_link_icons' ),
'type' => 'option',
'capability' => 'edit_theme_options',
)
);
$wp_customize->add_control(
'trestle_external_link_icons',
array(
'section' => 'trestle_settings_section',
'settings' => 'genesis-settings[trestle_external_link_icons]',
'label' => __( 'Add icons to external links', 'trestle' ),
'type' => 'checkbox',
'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[external_link_icons]',
'label' => __( 'Add icons to external links', 'trestle' ),
'type' => 'checkbox',
)
);
// E-mail Link Icons
// E-mail Link Icons.
$wp_customize->add_setting(
'genesis-settings[trestle_email_link_icons]',
'trestle-settings[email_link_icons]',
array(
'default' => genesis_get_option( 'trestle_email_link_icons' ),
'type' => 'option',
'transport' => 'postMessage',
'capability' => 'edit_theme_options',
'default' => trestle_get_option( 'email_link_icons' ),
'type' => 'option',
'capability' => 'edit_theme_options',
)
);
$wp_customize->add_control(
'trestle_email_link_icons',
array(
'section' => 'trestle_settings_section',
'settings' => 'genesis-settings[trestle_email_link_icons]',
'label' => __( 'Add icons to email links', 'trestle' ),
'type' => 'checkbox',
'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[email_link_icons]',
'label' => __( 'Add icons to email links', 'trestle' ),
'type' => 'checkbox',
)
);
// PDF Link Icons
// PDF Link Icons.
$wp_customize->add_setting(
'genesis-settings[trestle_pdf_link_icons]',
'trestle-settings[pdf_link_icons]',
array(
'default' => genesis_get_option( 'trestle_pdf_link_icons' ),
'type' => 'option',
'transport' => 'postMessage',
'capability' => 'edit_theme_options',
'default' => trestle_get_option( 'pdf_link_icons' ),
'type' => 'option',
'capability' => 'edit_theme_options',
)
);
$wp_customize->add_control(
'trestle_pdf_link_icons',
array(
'section' => 'trestle_settings_section',
'settings' => 'genesis-settings[trestle_pdf_link_icons]',
'label' => __( 'Add icons to .pdf links', 'trestle' ),
'type' => 'checkbox',
'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[pdf_link_icons]',
'label' => __( 'Add icons to .pdf links', 'trestle' ),
'type' => 'checkbox',
)
);
// Doc Link Icons
// Doc Link Icons.
$wp_customize->add_setting(
'genesis-settings[trestle_doc_link_icons]',
'trestle-settings[doc_link_icons]',
array(
'default' => genesis_get_option( 'trestle_doc_link_icons' ),
'type' => 'option',
'transport' => 'postMessage',
'capability' => 'edit_theme_options',
'default' => trestle_get_option( 'doc_link_icons' ),
'type' => 'option',
'capability' => 'edit_theme_options',
)
);
$wp_customize->add_control(
'trestle_doc_link_icons',
array(
'section' => 'trestle_settings_section',
'settings' => 'genesis-settings[trestle_doc_link_icons]',
'label' => __( 'Add icons to .doc links', 'trestle' ),
'type' => 'checkbox',
'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[doc_link_icons]',
'label' => __( 'Add icons to .doc links', 'trestle' ),
'type' => 'checkbox',
)
);
File diff suppressed because it is too large Load Diff
+182 -236
View File
@@ -9,20 +9,57 @@
* @package Trestle
*/
/*===========================================
* Theme Setup
===========================================*/
add_action( 'after_setup_theme', 'trestle_add_theme_support' );
/**
* Initialize Trestle defaults and theme options.
*
* @since 2.0.0
*/
function trestle_add_theme_support() {
// Add HTML5 markup structure.
add_theme_support( 'html5' );
// Add viewport meta tag for mobile browsers.
add_theme_support( 'genesis-responsive-viewport' );
// Add support for footer widgets if specified in Trestle settings.
add_theme_support( 'genesis-footer-widgets', trestle_get_option( 'footer_widgets_number' ) );
}
add_action( 'after_setup_theme', 'trestle_remove_genesis_css_enqueue' );
/**
* Stop Genesis from enqueuing the child theme stylesheet in the usual way.
*
* @since 2.1.0
*/
function trestle_remove_genesis_css_enqueue() {
remove_action( 'genesis_meta', 'genesis_load_stylesheet' );
}
/*===========================================
* 3rd Party Libraries
===========================================*/
add_action( 'init', 'trestle_load_bfa' );
/**
/**
* Initialize the Better Font Awesome Library.
*
* @since 2.0.0
*/
function trestle_load_bfa() {
// Set the library initialization args
$args = array(
// Better Font Awesome Library
require_once trailingslashit( get_stylesheet_directory() ) . 'lib/better-font-awesome-library/better-font-awesome-library.php';
// Set the library initialization args.
$args = array(
'version' => 'latest',
'minified' => true,
'remove_existing_fa' => false,
@@ -30,10 +67,10 @@ function trestle_load_bfa() {
'load_admin_styles' => true,
'load_shortcode' => true,
'load_tinymce_plugin' => true,
);
);
// Initialize the Better Font Awesome Library.
Better_Font_Awesome_Library::get_instance( $args );
// Initialize the Better Font Awesome Library.
Better_Font_Awesome_Library::get_instance( $args );
}
@@ -41,7 +78,7 @@ function trestle_load_bfa() {
* Header
===========================================*/
add_action( 'wp_enqueue_scripts', 'trestle_header_actions' );
add_action( 'wp_enqueue_scripts', 'trestle_header_actions', 15 );
/**
* Loads theme scripts and styles.
*
@@ -49,26 +86,39 @@ add_action( 'wp_enqueue_scripts', 'trestle_header_actions' );
*/
function trestle_header_actions() {
// Google fonts
// Our main stylesheet.
wp_enqueue_style( 'trestle', get_stylesheet_uri(), array(), TRESTLE_THEME_VERSION );
// Google fonts.
wp_enqueue_style( 'theme-google-fonts', '//fonts.googleapis.com/css?family=Lato:300,400,700' );
// Theme jQuery
wp_enqueue_script( 'theme-jquery', get_stylesheet_directory_uri() . '/includes/js/theme-jquery.js', array( 'jquery' ), CHILD_THEME_VERSION, true );
// Theme jQuery.
wp_enqueue_script( 'theme-jquery', get_stylesheet_directory_uri() . '/includes/js/theme-jquery.js', array( 'jquery' ), TRESTLE_THEME_VERSION, true );
// Get WP uploads directory
// Prepare and include some necessary variables.
$mobile_nav_text = apply_filters( 'trestle_mobile_nav_text', __( 'Navigation', 'trestle' ) );
wp_localize_script(
'theme-jquery',
'trestle_vars',
array(
'mobile_nav_text' => esc_attr( $mobile_nav_text ),
)
);
// Get WP uploads directory.
$upload_dir = wp_upload_dir();
$upload_path = $upload_dir['basedir'];
$upload_url = $upload_dir['baseurl'];
// Custom CSS (if it exists)
// Custom CSS (if it exists).
$custom_css_file = '/trestle/custom.css';
if ( is_readable( $upload_path . $custom_css_file ) )
wp_enqueue_style( 'trestle-custom-css', $upload_url . $custom_css_file );
// Custom jQuery (if it exists)
// Custom jQuery (if it exists).
$custom_js_file = '/trestle/custom.js';
if ( is_readable( $upload_path . $custom_js_file ) )
wp_enqueue_script( 'trestle-custom-jquery', $upload_url . $custom_js_file, array( 'jquery' ), CHILD_THEME_VERSION, true );
wp_enqueue_script( 'trestle-custom-jquery', $upload_url . $custom_js_file, array( 'jquery' ), TRESTLE_THEME_VERSION, true );
}
@@ -83,7 +133,9 @@ add_filter( 'genesis_pre_load_favicon', 'trestle_do_custom_favicon' );
* @return string Custom favicon URL (if specified), or the default URL.
*/
function trestle_do_custom_favicon( $favicon_url ) {
return genesis_get_option( 'trestle_favicon_url' ) ? genesis_get_option( 'trestle_favicon_url' ) : $favicon_url;
$trestle_favicon_url = trestle_get_option( 'favicon_url' );
return $trestle_favicon_url ? $trestle_favicon_url : $favicon_url;
}
/*===========================================
@@ -101,34 +153,51 @@ add_filter( 'body_class', 'trestle_body_classes' );
*/
function trestle_body_classes( $classes ) {
// Add 'no-jquery' class to be removed by jQuery if enabled
// Add 'no-jquery' class to be removed by jQuery if enabled.
$classes[] = 'no-jquery';
// Add 'bubble' class
if ( 'bubble' == genesis_get_option( 'trestle_layout' ) )
// Add 'bubble' class.
if ( 'bubble' == trestle_get_option( 'layout' ) )
$classes[] = 'bubble';
// Add link icon classes
if ( genesis_get_option( 'trestle_external_link_icons' ) )
// Add link icon classes.
if ( trestle_get_option( 'external_link_icons' ) ) {
$classes[] = 'external-link-icons';
if ( genesis_get_option( 'trestle_email_link_icons' ) )
}
if ( trestle_get_option( 'email_link_icons' ) ) {
$classes[] = 'email-link-icons';
if ( genesis_get_option( 'trestle_pdf_link_icons' ) )
}
if ( trestle_get_option( 'pdf_link_icons' ) ) {
$classes[] = 'pdf-link-icons';
if ( genesis_get_option( 'trestle_doc_link_icons' ) )
}
if ( trestle_get_option( 'doc_link_icons' ) ) {
$classes[] = 'doc-link-icons';
}
// Add menu style class
if ( genesis_get_option( 'trestle_nav_primary_location' ) )
$classes[] = 'nav-primary-location-' . esc_attr( genesis_get_option( 'trestle_nav_primary_location' ) );
// Add menu style class.
$nav_primary_location = esc_attr( trestle_get_option( 'nav_primary_location' ) );
if ( $nav_primary_location ) {
$classes[] = 'nav-primary-location-' . $nav_primary_location;
}
// Add footer widget number class
if ( genesis_get_option( 'trestle_footer_widgets_number' ) )
$classes[] = 'footer-widgets-number-' . esc_attr( genesis_get_option( 'trestle_footer_widgets_number' ) );
// Add mobile menu toggle class.
$mobile_nav_toggle = esc_attr( trestle_get_option( 'mobile_nav_toggle' ) );
if ( 'big-button' == $mobile_nav_toggle ) {
$classes[] = 'big-button-nav-toggle';
} elseif ( 'small-icon' == $mobile_nav_toggle ) {
$classes[] = 'small-icon-nav-toggle';
}
// Add logo class
if ( genesis_get_option( 'trestle_logo_url' ) || genesis_get_option( 'trestle_logo_url_mobile' ) )
// Add footer widget number class.
$footer_widgets_number = esc_attr( trestle_get_option( 'footer_widgets_number' ) );
if ( $footer_widgets_number ) {
$classes[] = 'footer-widgets-number-' . $footer_widgets_number;
}
// Add logo class.
if ( trestle_get_option( 'logo_url' ) || trestle_get_option( 'logo_url_mobile' ) ) {
$classes[] = 'has-logo';
}
return $classes;
@@ -147,42 +216,55 @@ add_filter( 'genesis_seo_title', 'trestle_do_logos', 10, 3 );
*/
function trestle_do_logos( $title, $inside, $wrap ) {
$logo_url = genesis_get_option( 'trestle_logo_url' );
$logo_url_mobile = genesis_get_option( 'trestle_logo_url_mobile' );
$logo_id = trestle_get_option( 'logo_id' );
$logo_id_mobile = trestle_get_option( 'logo_id_mobile' );
$logo_html = '';
// Regular logo
if ( $logo_url ) {
// Regular logo.
if ( $logo_id ) {
// Default logo class
$classes = array('logo-full');
// If no mobile logo is specified, make regular logo act as mobile logo too
if( ! $logo_url_mobile )
$classes[] = 'show';
$logo_html .= sprintf( '<img class="logo %s" alt="%s" src="%s" />',
implode(' ', $classes),
esc_attr( get_bloginfo( 'name' ) ),
$logo_url
// Default logo classes.
$classes = array(
'logo',
'logo-full'
);
// If no mobile logo is specified, make regular logo act as mobile logo too.
if( ! $logo_id_mobile ) {
$classes[] = 'show';
}
// Prepare the classes.
$logo_attr = array(
'class' => implode( $classes, ' ' ),
);
// Build the <img> tag.
$logo_html .= wp_get_attachment_image( $logo_id, 'full', false, $logo_attr );
}
// Mobile logo
if ( $logo_url_mobile ) {
// Mobile logo.
if ( $logo_id_mobile ) {
// Default mobile logo class
$classes = array('logo-mobile');
// Default mobile logo class.
$classes = array(
'logo',
'logo-mobile'
);
// If no regular logo is specified, make mobile logo act as regular logo too
if( ! $logo_url )
// If no regular logo is specified, make mobile logo act as regular logo too.
if( ! $logo_id )
$classes[] = 'show';
$logo_html .= sprintf( '<img class="logo %s" alt="%s" src="%s" />',
implode(' ', $classes),
esc_attr( get_bloginfo( 'name' ) ),
$logo_url_mobile
// Prepare the classes.
$logo_attr = array(
'class' => implode( $classes, ' ' ),
);
// Build the <img> tag.
$logo_html .= wp_get_attachment_image( $logo_id_mobile, 'full', false, $logo_attr );
}
if ( $logo_html ) {
@@ -193,12 +275,13 @@ function trestle_do_logos( $title, $inside, $wrap ) {
);
}
// Build the title
// Build the title.
$title = genesis_html5() ? sprintf( "<{$wrap} %s>", genesis_attr( 'site-title' ) ) : sprintf( '<%s id="title">%s</%s>', $wrap, $inside, $wrap );
$title .= genesis_html5() ? "{$inside}</{$wrap}>" : '';
// Echo (filtered)
// Echo (filtered).
return $title;
}
@@ -206,150 +289,68 @@ function trestle_do_logos( $title, $inside, $wrap ) {
* Navigation
===========================================*/
add_action( 'init', 'trestle_nav_modifications' );
/**
* Performs modifications to the primary navigation menu
*
* @since 1.0.0
*
* @see trestle_add_mobile_nav()
* @see trestle_auto_nav_items()
* @see trestle_custom_nav_extras()
* @see trestle_nav_placeholder()
*/
function trestle_nav_modifications() {
global $trestle_nav_title;
// Set title for Trestle placeholder navigation menu
$trestle_nav_title = __( 'Trestle Auto Nav Placeholder', 'trestle' );
// Auto-generate nav if Genesis theme setting is checked
if ( 1 == genesis_get_option( 'trestle_auto_nav' ) ) {
add_filter( 'wp_nav_menu_items', 'trestle_auto_nav_items', 9, 2 );
}
// Do custom nav extras
if ( 1 == genesis_get_option( 'trestle_custom_nav_extras' ) ) {
// Remove default nav extras
remove_filter( 'wp_nav_menu_items', 'genesis_nav_right' );
// Add custom nav extras
add_filter( 'wp_nav_menu_items', 'trestle_custom_nav_extras', 10, 2 );
}
// Create placeholder navigation menu object if needed
trestle_nav_placeholder();
}
add_action( 'init', 'trestle_nav_primary_location' );
add_action( 'wp_loaded', 'trestle_nav_primary_location' );
/**
* Move primary navigation into the header if need be.
*
* This is hooked on wp_loaded instead of init because for some reason init
* won't fire on the customizer preview.
*
* @since 1.2.0
*/
function trestle_nav_primary_location() {
if ( 'header' == genesis_get_option( 'trestle_nav_primary_location' ) ) {
if ( 'header' == trestle_get_option( 'nav_primary_location' ) ) {
remove_action( 'genesis_after_header', 'genesis_do_nav' );
add_action( 'genesis_header', 'genesis_do_nav', 12 );
}
}
add_filter( 'wp_nav_menu_items', 'trestle_custom_nav_extras', 10, 2 );
/**
* Auto-generates list of pages for use in the primary navigation menu.
* Add custom nav extras.
*
* @since 1.0.0
*
* @param string $nav_items <li> list of navigation menu items.
* @param stdClass $menu_args Arguments for the menu.
* @return string <li> list of (modified) navigation menu items.
*/
function trestle_auto_nav_items( $nav_items, stdClass $menu_args ) {
if ( 'primary' == $menu_args->theme_location ) {
$args = array(
'depth' => genesis_get_option( 'trestle_auto_nav_depth' ) ? genesis_get_option( 'trestle_auto_nav_depth' ) : 0,
'echo' => false,
'show_home' => ( genesis_get_option( 'trestle_include_home_link' ) && genesis_get_option( 'trestle_home_link_text' ) ) ? do_shortcode( genesis_get_option( 'trestle_home_link_text' ) ): genesis_get_option( 'trestle_include_home_link' ),
'menu_class' => 'auto-menu'
);
$ul_class = 'menu genesis-nav-menu menu-primary';
$menu_args = new stdClass();
$menu_args->theme_location = 'primary';
$nav_items = wp_page_menu( $args );
// Remove opening <div class="auto-nav"><ul>
$nav_items = preg_replace( '/<div\s*.*auto-menu[^>]*>\s*<ul>/', '', $nav_items );
// Remove closing </ul></div>
$nav_items = preg_replace( '/<\/ul>\s*<\/div>/', '', $nav_items );
}
return $nav_items;
}
/**
* Replaces standard Genesis navigation extras with custom input navigation extras.
*
* @since 1.0.0
*
* @param string $nav_items <li> list of menu items.
* @param stdClass $menu_args Arguments for the menu.
* @param string $nav_items <li> list of menu items.
* @param stdClass $menu_args Arguments for the menu.
* @return string <li> list of menu items with custom navigation extras <li> appended.
*/
function trestle_custom_nav_extras( $nav_items, stdClass $menu_args ) {
if ( 'primary' == $menu_args->theme_location ) {
$custom_text = esc_attr( genesis_get_option( 'trestle_custom_nav_extras_text' ) );
return $nav_items . '<li class="right custom">' . do_shortcode( genesis_get_option( 'trestle_custom_nav_extras_text' ) ) . '</li>';
if ( 'primary' == $menu_args->theme_location && trestle_get_option( 'search_in_nav' ) ) {
return $nav_items . '<li class="right custom">' . get_search_form( false ) . '</li>';
}
return $nav_items;
}
/**
* Generates a placeholder navigation menu object.
*
* When using Trestle's auto-generated navigation feature,
* it is necessary to ensure that some nav menu object is
* selected as primary otherwise no navigation will be generated.
*
* @since 1.0.0
*/
function trestle_nav_placeholder() {
global $trestle_nav_title;
// Create placeholder menu for 'primary' spot if auto-nav is selected - this ensures that nav extras can be used even when no custom menu is formally set to primary
if ( 1 == genesis_get_option( 'trestle_auto_nav' ) && ! wp_get_nav_menu_object( $trestle_nav_title ) ) {
wp_create_nav_menu( $trestle_nav_title );
}
// Assign placeholder menu to 'primary' if auto-nav is selected and there is no current primary menu
if ( 1 == genesis_get_option( 'trestle_auto_nav' ) && ! wp_get_nav_menu_object( $trestle_nav_title ) && ! has_nav_menu( 'primary' ) ) {
$menu_locations = get_theme_mod( 'nav_menu_locations' );
$menu_locations['primary'] = wp_get_nav_menu_object( $trestle_nav_title )->term_id;
set_theme_mod( 'nav_menu_locations', $menu_locations );
}
// Remove placeholder menu if auto-nav is disabled
$menus = get_registered_nav_menus();
if ( 1 != genesis_get_option( 'trestle_auto_nav' ) && wp_get_nav_menu_object( $trestle_nav_title ) && $trestle_nav_title != $menus['primary'] )
wp_delete_nav_menu( $trestle_nav_title );
}
/*===========================================
* Posts & Pages
===========================================*/
add_filter( 'post_class', 'trestle_post_classes' );
/**
* Add extra classes to posts in certain situations.
*
* @since 2.2.0
*
* @param array $classes Post classes.
* @return array Updated post classes.
*/
function trestle_post_classes( $classes ) {
// If post doesn't have a featured image.
if ( ! has_post_thumbnail() ) {
$classes[] = 'no-featured-image';
}
return $classes;
}
add_filter( 'wp_revisions_to_keep', 'trestle_update_revisions_number', 10, 2 );
/**
* Sets the number of post revisions.
@@ -361,69 +362,18 @@ add_filter( 'wp_revisions_to_keep', 'trestle_update_revisions_number', 10, 2 );
*/
function trestle_update_revisions_number( $num ) {
$trestle_revisions_number = esc_attr( genesis_get_option( 'trestle_revisions_number' ) );
$trestle_revisions_number = esc_attr( trestle_get_option( 'revisions_number' ) );
if ( isset( $trestle_revisions_number ) )
if ( isset( $trestle_revisions_number ) ) {
return $trestle_revisions_number;
}
return $num;
}
add_action( 'the_post', 'trestle_post_info_meta', 5 );
/**
* Manually controls display of post info/meta for all post types.
*
* @since 1.0.0
*
* @see trestle_set_page_post_type()
* @global object $post The current $post object.
*/
function trestle_post_info_meta() {
if ( ! is_admin() && in_the_loop() && genesis_get_option( 'trestle_manual_post_info_meta' ) ) {
global $post;
// Get post type
$post_type = get_post_type( $post->ID );
// Remove all Post Info & Meta
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
// Single
if ( is_singular() ) {
$single_info_option = 'trestle_post_info_' . $post_type . '_single';
$single_meta_option = 'trestle_post_meta_' . $post_type . '_single';
// Post Info
if ( genesis_get_option( $single_info_option ) )
add_action( 'genesis_entry_header', 'genesis_post_info', 12 );
// Post Meta
if ( genesis_get_option( $single_meta_option ) )
add_action( 'genesis_entry_footer', 'genesis_post_meta' );
}
// Archive
if ( ! is_singular() ) {
$archive_info_option = 'trestle_post_info_' . $post_type . '_archive';
$archive_meta_option = 'trestle_post_meta_' . $post_type . '_archive';
// Post Info
if ( genesis_get_option( $archive_info_option ) )
add_action( 'genesis_entry_header', 'genesis_post_info', 12 );
// Post Meta
if ( genesis_get_option( $archive_meta_option ) )
add_action( 'genesis_entry_footer', 'genesis_post_meta' );
}
}
}
add_filter( 'genesis_get_image_default_args', 'trestle_featured_image_fallback' );
/**
* Unset Genesis default featured image fallback of 'first-attached'
* Unset Genesis default featured image fallback of 'first-attached'.
*
* This function prevents Genesis' default behavior of displaying
* the 'first-attached' image as a post's featured image (in archive)
@@ -431,8 +381,8 @@ add_filter( 'genesis_get_image_default_args', 'trestle_featured_image_fallback'
*
* @since 1.0.0
*
* @param array $args Default Genesis image args
* @return array Updated image args
* @param array $args Default Genesis image args.
* @return array Updated image args.
*/
function trestle_featured_image_fallback( $args ) {
@@ -459,14 +409,10 @@ add_filter( 'the_content_more_link', 'trestle_read_more_link' );
*/
function trestle_read_more_link( $default_text ) {
// Get Trestle custom "read more" link text
$custom_text = esc_attr( genesis_get_option( 'trestle_read_more_text' ) );
// Get Trestle custom "read more" link text.
$custom_text = esc_attr( trestle_get_option( 'read_more_text' ) );
<<<<<<< HEAD
if ( $custom_text ) {
=======
if ( $custom_text )
>>>>>>> 9de3310f116bb4f7dd5323ca40b16f2fe4160dcd
if ( $custom_text ) {
return '&hellip;&nbsp;<a class="more-link" title="' . $custom_text . '" href="' . get_permalink() . '">' . $custom_text . '</a>';
} else {
return $default_text;
Regular → Executable
+111 -94
View File
@@ -6,135 +6,152 @@
* @package Trestle
*/
// Executes when the document is ready
// Executes when the document is ready.
jQuery( document ).ready( function( $ ) {
// Remove .no-jquery body class
$( 'body' ).removeClass( 'no-jquery' );
// Store selectors we use multiple times.
$body = $( 'body' );
// External Links
var h = window.location.host.toLowerCase();
$( '[href^="http"]' ).not( '[href*="' + h + '"]' ).addClass( 'external-link' ).attr( "target", "_blank" );
// Remove .no-jquery body class.
$body.removeClass( 'no-jquery' );
// Add classes to different types of links
$( 'a[href^="mailto:"]' ).addClass( 'email-link' );
$( 'a[href$=".pdf"]' ).attr({ "target":"_blank" }).addClass( 'pdf-link' );
$( 'a[href$=".doc"]' ).attr({ "target":"_blank" }).addClass( 'doc-link' );
$( 'a' ).has( 'img' ).addClass( 'image-link' );
// External Links.
var h = window.location.host.toLowerCase();
$( '[href^="http"]' ).not( '[href*="' + h + '"]' ).addClass( 'external-link' ).attr( "target", "_blank" );
// Add classes to parts of lists
$( 'li:last-child' ).addClass( 'last' );
$( 'li:first-child' ).addClass( 'first' );
$( 'ul, ol' ).parent( 'li' ).addClass( 'parent' );
// Add classes to different types of links.
$( 'a[href^="mailto:"]' ).addClass( 'email-link' );
$( 'a[href$=".pdf"]' ).attr({ "target":"_blank" }).addClass( 'pdf-link' );
$( 'a[href$=".doc"]' ).attr({ "target":"_blank" }).addClass( 'doc-link' );
$( 'a' ).has( 'img' ).addClass( 'image-link' );
// Mobile header toggle buttons
$( '.site-header .title-area' ).after( '<div class="toggle-buttons" />' );
$( '.site-header .widget-area, .nav-primary' ).each( function( i ) {
// Add classes to parts of lists.
$( 'li:last-child' ).addClass( 'last' );
$( 'li:first-child' ).addClass( 'first' );
$( 'ul, ol' ).parent( 'li' ).addClass( 'parent' );
// Store target
$target = $( this );
// Create container for toggle buttons.
if ( $body.hasClass( 'big-button-nav-toggle' ) ) {
$( '.site-header' ).after( '<div class="header-toggle-buttons" />' );
} else {
$( '.site-header .title-area' ).after( '<div class="header-toggle-buttons" />' );
}
// Scope variables
var $target, buttonClass, targetClass;
// Add either small icon toggles or big button toggle.
$( '.site-header .widget-area, .nav-primary' ).each( function( i ) {
// Setup classes
buttonClass = 'toggle-button';
targetClass = $target.attr( 'class' ).split( /\s+/ );
// Store target.
$target = $( this );
// Add targets-[] class to buttonClass
$.each( targetClass, function( index, value ) {
buttonClass += ' targets-' + value;
});
// Scope variables.
var $target, buttonClass, targetClass;
// Add nav-toggle class to buttonClass if the button is for the nav
if ( $target.is( 'nav' ) ) {
buttonClass += ' nav-toggle';
}
// Setup classes.
buttonClass = 'toggle-button';
targetClass = $target.attr( 'class' ).split( /\s+/ );
// Add toggle buttons to header
$( '.toggle-buttons' ).prepend( '<a id="toggle-button-' + i + '" class="' + buttonClass + '" href="#">Toggle</a>' );
// Add targets-[] class to buttonClass.
$.each( targetClass, function( index, value ) {
buttonClass += ' targets-' + value;
});
// Add target class to nav and widget areas
$target.addClass( 'toggle-target-' + i );
});
// Add nav-toggle class to buttonClass if the button is for the nav.
if ( $target.is( 'nav' ) ) {
buttonClass += ' nav-toggle';
}
// Toggle widget areas and primary nav
$( '.site-header .toggle-button' ).click( function( event ) {
// Allow the use of custom text when using the 'big-button' mobile nav style.
if ( $target.is( 'nav' ) && $body.hasClass( 'big-button-nav-toggle' ) ) {
navText = trestle_vars['mobile_nav_text'];
} else {
navText = 'Toggle';
}
// Prevent default behavior
event.preventDefault();
// Add toggle buttons to header.
$( '.header-toggle-buttons' ).prepend( '<a id="toggle-button-' + i + '" class="' + buttonClass + '" href="#">' + navText + '</a>' );
// Scope our variables
var $button, $target;
// Add target class to nav and widget areas.
$target.addClass( 'toggle-target-' + i );
});
// Get toggle button that was clicked
$button = $( this );
// A widget areas and primary nav mobile toggle functionality.
$( '.header-toggle-buttons .toggle-button' ).click( function( event ) {
//Remove focus
$button.blur();
// Prevent default behavior.
event.preventDefault();
// Match the button to the right target
$target = $( '.toggle-target-' + $button.attr( 'id' ).match( /\d+/ ) );
// Scope our variables.
var $button, $target;
// Toggle buttons
$button.toggleClass( 'open' );
$( '.site-header .toggle-button' ).not( $button ).removeClass( 'open' );
// Get toggle button that was clicked.
$button = $( this );
// Toggle targets
$target.toggleClass( 'open' );
$( '[class^="toggle-target"]' ).not( $target ).removeClass( 'open' );
});
// Match the button to the right target.
$target = $( '.toggle-target-' + $button.attr( 'id' ).match( /\d+/ ) );
// Mobile navigation icons
var closedIcon = '+';
var openIcon = '-';
// Toggle buttons.
$button.toggleClass( 'open' );
$( '.header-toggle-buttons .toggle-button' ).not( $button ).removeClass( 'open' );
// Insert the icons into the nav where appropriate
$( '.nav-primary' ).find( '.genesis-nav-menu .parent:not( .current-menu-item, .current_page_item, .current_page_parent, .current_page_ancestor) > a' ).after( '<a class="sub-icon" href="#">' + closedIcon + '</a>' );
$( '.nav-primary' ).find( '.genesis-nav-menu .parent.current-menu-item > a, .genesis-nav-menu .parent.current_page_item > a, .genesis-nav-menu .parent.current_page_parent > a, .genesis-nav-menu .parent.current_page_ancestor > a' ).after( '<a class="sub-icon" href="#">' + openIcon + '</a>' );
// Toggle targets.
$target.toggleClass( 'open' );
$( '[class*="toggle-target"]' ).not( $target ).removeClass( 'open' );
// Mobile navigation expand/contract functionality
$( '.sub-icon' ).click( function( event ) {
// Remove focus.
$button.blur();
// Prevent default behavior
event.preventDefault();
});
// Get icon click
var $icon = $( this );
// Mobile navigation icons.
var closedIcon = '+';
var openIcon = '-';
// Remove focus
$icon.blur();
// Insert the icons into the nav where appropriate.
$( '.nav-primary' ).find( '.genesis-nav-menu .parent:not( .current-menu-item, .current_page_item, .current_page_parent, .current_page_ancestor) > a' ).after( '<a class="sub-icon" href="#">' + closedIcon + '</a>' );
$( '.nav-primary' ).find( '.genesis-nav-menu .parent.current-menu-item > a, .genesis-nav-menu .parent.current_page_item > a, .genesis-nav-menu .parent.current_page_parent > a, .genesis-nav-menu .parent.current_page_ancestor > a' ).after( '<a class="sub-icon" href="#">' + openIcon + '</a>' );
// Expand/contract
$icon.next( 'ul' ).slideToggle().toggleClass( 'open' );
// Mobile navigation expand/contract functionality.
$( '.sub-icon' ).click( function( event ) {
// Change the icon to indicate open/closed
if ( $icon.text().indexOf( closedIcon ) !== -1 ) {
$icon.text( openIcon );
} else if ( $icon.text().indexOf( openIcon ) !== -1 ) {
$icon.text( closedIcon );
}
});
// Prevent default behavior.
event.preventDefault();
// Header widget area expand/contract functionality
$( '.widget-area-toggle' ).click( function( event ) {
// Get icon click.
var $icon = $( this );
// Prevent default behavior
event.preventDefault();
// Remove focus.
$icon.blur();
// Get button clicked
var $button = $( this );
// Expand/contract.
$icon.next( 'ul' ).slideToggle().toggleClass( 'open' );
// Remove focus
$button.blur();
// Change the icon to indicate open/closed.
if ( $icon.text().indexOf( closedIcon ) !== -1 ) {
$icon.text( openIcon );
} else if ( $icon.text().indexOf( openIcon ) !== -1 ) {
$icon.text( closedIcon );
}
});
// Expand/contract
$button.toggleClass( 'open' ).next( '.widget-area' ).slideToggle();
});
// Header widget area expand/contract functionality.
$( '.widget-area-toggle' ).click( function( event ) {
// Executes when complete page is fully loaded, including all frames, objects, and images
$( window ).on( 'load', function() {
// Prevent default behavior.
event.preventDefault();
});
// Get button clicked.
var $button = $( this );
// Remove focus.
$button.blur();
// Expand/contract.
$button.toggleClass( 'open' ).next( '.widget-area' ).slideToggle();
});
// Executes when complete page is fully loaded, including all frames, objects, and images.
$( window ).on( 'load', function() {
});
}); /* end of page load scripts */
+58 -53
View File
@@ -1,6 +1,6 @@
<?php
<?php
/**
* Trestle shortcodes
* Trestle shortcodes.
*
* @since 1.0.0
*
@@ -11,9 +11,9 @@
* Shortcodes
===========================================*/
add_filter('the_content', 'trestle_shortcode_empty_paragraph_fix');
add_filter( 'the_content', 'trestle_shortcode_empty_paragraph_fix' );
/**
* Fix for empty <p> tags around shortcodes
* Fix for empty <p> tags around shortcodes.
*
* @since 1.0.0
*
@@ -21,23 +21,22 @@ add_filter('the_content', 'trestle_shortcode_empty_paragraph_fix');
*
* @return string Updated content.
*/
function trestle_shortcode_empty_paragraph_fix( $content )
{
function trestle_shortcode_empty_paragraph_fix( $content ) {
$array = array (
'<p>[' => '[',
']</p>' => ']',
'<p>[' => '[',
']</p>' => ']',
']<br />' => ']'
);
$content = strtr($content, $array);
$content = strtr( $content, $array );
return $content;
}
add_shortcode( 'col', 'trestle_column' );
/**
* Columns
*
* Columns.
*
* Example:
* [col class="one-half first no-list-margin"] Contents [/col]
*
@@ -51,18 +50,19 @@ add_shortcode( 'col', 'trestle_column' );
* @return string Shortcode output.
*/
function trestle_column( $atts, $content = null ) {
extract( shortcode_atts( array(
$atts = shortcode_atts( array(
'class' => '',
), $atts ) );
return '<div class="col ' . $class . '">' . do_shortcode( $content ) . '</div>';
), $atts );
return '<div class="col ' . $atts['class'] . '">' . do_shortcode( $content ) . '</div>';
}
add_shortcode( 'button', 'trestle_button' );
/**
* Button
*
* Button.
*
* Example: [button href="url" title="title" target="target" class="class"]Text[/button]
*
* @param array $atts Shortcode attributes.
@@ -70,19 +70,21 @@ add_shortcode( 'button', 'trestle_button' );
* @return string Shortcode output.
*/
function trestle_button( $atts, $content = null ) {
extract( shortcode_atts( array(
$atts = shortcode_atts( array(
'href' => '#',
'target' => '',
'title' => '',
'class' => '',
), $atts ) );
return '<a class="button ' . $class . '" href="' . $href . '" title="' . $title . '" target="' . $target . '">' . do_shortcode( $content ) . '</a>';
}
), $atts );
return '<a class="button ' . $atts['class'] . '" href="' . $atts['href'] . '" title="' . $atts['title'] . '" target="' . $atts['target'] . '">' . do_shortcode( $content ) . '</a>';
}
add_shortcode( 'date', 'trestle_date' );
/**
* Date
* Date.
*
* Example: [date format="M d, Y"]
*
@@ -91,21 +93,23 @@ add_shortcode( 'date', 'trestle_date' );
* @return string Shortcode output.
*/
function trestle_date( $atts ) {
extract( shortcode_atts( array(
'format' => 'M d, Y',
), $format ) );
if ( ! $format ) {
$format = 'M d, Y';
$atts = shortcode_atts( array(
'format' => 'M d, Y',
), $atts );
if ( ! $atts['format'] ) {
$atts['format'] = 'M d, Y';
}
return date( $format );
return date( $atts['format'] );
}
add_shortcode( 'blockquote', 'trestle_blockquote_shortcode' );
/**
* Blockquote
*
* Blockquote.
*
* Example: [blockquote citation=""]Content[/blockquote]
*
* @since 1.2.0
@@ -115,28 +119,29 @@ add_shortcode( 'blockquote', 'trestle_blockquote_shortcode' );
* @return string Shortcode output.
*/
function trestle_blockquote_shortcode( $atts, $content = null ) {
$atts = shortcode_atts( array(
'citation' => '',
), $atts );
ob_start(); ?>
<blockquote>
<?php if ( $content ) : ?>
<?php echo $content; ?>
<?php endif; ?>
<?php if ( $atts['citation'] ) : ?>
<cite>- <?php echo $atts['citation']; ?></cite>
<?php endif; ?>
</blockquote>
<?php
$output = ob_get_clean();
$atts = shortcode_atts( array(
'citation' => '',
), $atts );
ob_start(); ?>
<blockquote>
<?php if ( $content ) : ?>
<?php echo $content; ?>
<?php endif; ?>
<?php if ( $atts['citation'] ) : ?>
<cite>- <?php echo $atts['citation']; ?></cite>
<?php endif; ?>
</blockquote>
<?php
$output = ob_get_clean();
return $output;
return $output;
}
+21
View File
@@ -0,0 +1,21 @@
<?php
/**
* Development utility functions.
*
* @since 2.1.0
*
* @package Trestle
*/
/**
* Custom logging function for development purposes.
*/
function trestle_log( $log ) {
if ( true === WP_DEBUG ) {
if ( is_array( $log ) || is_object( $log ) ) {
error_log( print_r( $log, true ) );
} else {
error_log( $log );
}
}
}
+4 -4
View File
@@ -1,16 +1,16 @@
<?php
/**
* Trestle widget area registration and functionality
*
* Trestle widget area registration and functionality.
*
* @since 1.0.0
*
*
* @package Trestle
*/
//add_action( 'widgets_init', 'trestle_register_widget_areas' );
/**
* Register custom widget areas
* Register custom widget areas.
*
* @since 1.0.0
*/
@@ -308,6 +308,9 @@ class Better_Font_Awesome_Library {
// Parse the initialization args with the defaults.
$this->parse_args( $args );
// Setup root URL, which differs for plugins vs. themes.
$this->setup_root_url();
// Set fallback stylesheet directory URL and path.
$this->setup_fallback_data();
@@ -345,6 +348,45 @@ class Better_Font_Awesome_Library {
}
/**
* Set up root URL for library, which differs for plugins vs. themes.
*
* @since 1.0.4
*/
function setup_root_url() {
// Get BFA directory and theme root directory paths.
$bfa_directory = dirname(__FILE__);
$theme_directory = get_stylesheet_directory();
$plugin_dir = plugin_dir_url( __FILE__ );
/**
* Check if we're inside a theme or plugin.
*
* If we're in a theme, than plugin_dir_url() will return a
* funky URL that includes the actual file path (e.g.
* /srv/www/site_name/wp-content/...)
*/
$is_theme = false;
if ( strpos( $plugin_dir, $bfa_directory ) !== false ) {
$is_theme = true;
}
// First check if we're inside a theme.
if ( $is_theme ) {
// Get relative BFA directory by removing theme root directory path.
$bfa_rel_path = str_replace( $theme_directory, '', $bfa_directory );
$this->root_url = trailingslashit( get_stylesheet_directory_uri() . $bfa_rel_path );
} else { // Otherwise we're inside a plugin.
$this->root_url = trailingslashit( plugin_dir_url( __FILE__ ) );
}
}
/**
* Set up data for the local fallback version of Font Awesome.
*
@@ -366,7 +408,7 @@ class Better_Font_Awesome_Library {
// Set fallback path and URL.
$this->fallback_data['path'] = $directory_path . 'css/font-awesome' . $this->get_min_suffix() . '.css';
$this->fallback_data['url'] = plugins_url( $this->fallback_data['directory'] . 'css/font-awesome' . $this->get_min_suffix() . '.css', dirname( $directory_path ) );
$this->fallback_data['url'] = $this->root_url . $this->fallback_data['directory'] . 'css/font-awesome' . $this->get_min_suffix() . '.css';
// Get the fallback version based on package.json.
$fallback_json_file_path = $directory_path . 'package.json';
@@ -965,9 +1007,9 @@ class Better_Font_Awesome_Library {
* being used.
*/
if ( version_compare( $tinymce_version, '4000', '>=' ) ) {
$plugin_array['bfa_plugin'] = plugins_url( 'js/tinymce-icons.js', __FILE__ );
$plugin_array['bfa_plugin'] = $this->root_url . 'js/tinymce-icons.js';
} else {
$plugin_array['bfa_plugin'] = plugins_url( 'js/tinymce-icons-old.js', __FILE__ );
$plugin_array['bfa_plugin'] = $this->root_url . 'js/tinymce-icons-old.js';
}
return $plugin_array;
@@ -1013,7 +1055,7 @@ class Better_Font_Awesome_Library {
* @since 1.0.0
*/
public function register_custom_admin_css() {
wp_enqueue_style( self::SLUG . '-admin-styles', plugins_url( 'css/admin-styles.css', __FILE__ ) );
wp_enqueue_style( self::SLUG . '-admin-styles', $this->root_url . 'css/admin-styles.css' );
}
/**
+2209
View File
File diff suppressed because it is too large Load Diff
Regular → Executable
+143 -80
View File
@@ -5,10 +5,10 @@
Description: Trestle is a Genesis child theme for developers based on the default <a href="http://www.genesisframework.com/">Genesis 2.0 Sample Theme</a>. It features mobile first CSS, helpful theme options, and lots more tools to support your development process.
Author: MIGHTYminnow
Author URI: http://www.mightyminnow.com/
Version: 1.1.0
Version: 2.1.0
Tags: black, gray, red, white, light, one-column, two-columns, three-columns, left-sidebar, right-sidebar, fluid-layout, responsive-layout, custom-background, custom-colors, custom-header, custom-menu, editor-style, featured-images, flexible-header, front-page-post-form, full-width-template, post-formats, rtl-language-support, sticky-post, theme-options, threaded-comments, translation-ready, genesis, mobile-first, responsive, clean
Text Domain: trestle
GitHub Theme URI: mickeykay/trestle
GitHub Theme URI: MIGHTYminnow/trestle
*/
/* Table of Contents
@@ -151,8 +151,13 @@ body {
line-height: 1.625;
}
/* Used in the editor */
body.mce-content-body {
width: 100%; /* Used in the editor */
width: auto;
margin: 10px;
float: none;
-webkit-font-smoothing: auto !important;
font-smoothing: auto !important;
}
body.bubble {
@@ -325,6 +330,11 @@ a:hover {
margin: 0 4px;
white-space: nowrap;
font-family: FontAwesome;
font-weight: normal;
font-stretch: normal;
font-style: normal;
font-variant: normal;
-webkit-font-smoothing: antialiased;
}
.external-link-icons .external-link:after {
@@ -599,40 +609,6 @@ body .red:hover {
border-color: #555;
}
body .blue {
background-color: #0971b2;
border-color: #0971b2;
}
body .blue:hover {
background-color: #333;
border-color: #333;
}
body .green {
background-color: #00a476;
border-color: #00a476;
}
body .green:hover {
background-color: #333;
border-color: #333;
}
.arrow-right:after {
display: inline-block;
content: "\00a0\00a0\f0a9";
font-family: FontAwesome;
line-height: 1;
}
.arrow-left:before {
display: inline-block;
content: "\f0a8\00a0\00a0";
font-family: FontAwesome;
line-height: 1;
}
/* Tables
--------------------------------------------- */
@@ -673,6 +649,10 @@ Structure and Layout
/* Site Containers
--------------------------------------------- */
.site-container {
position: relative;
}
.site-inner,
.wrap {
margin: 0 auto;
@@ -1286,6 +1266,11 @@ th a.wpv-header-desc:after {
margin-left: 0.5em;
font-family: FontAwesome;
font-size: 0.7em;
font-weight: normal;
font-stretch: normal;
font-style: normal;
font-variant: normal;
-webkit-font-smoothing: antialiased;
}
th a.wpv-header-desc:after {
@@ -1368,15 +1353,11 @@ Site Header
.site-header .widget-area {
width: 100%;
padding: 20px;
background-color: #eee;
border: 1px solid #ddd;
border-width: 0;
overflow: hidden;
}
.site-header .widget-area.open {
padding: 20px;
border-width: 1px 0;
overflow: hidden;
}
.site-header .search-form {
@@ -1389,48 +1370,87 @@ Site Header
/* Header Toggle Styles
--------------------------------------------- */
.site-header .toggle-buttons {
.header-toggle-buttons {
font-size: 0;
text-align: right;
}
.site-header .toggle-button {
.header-toggle-buttons .toggle-button {
margin-left: 15px;
}
.site-header .toggle-button.open {
.header-toggle-buttons .toggle-button.open {
color: #f15123;
}
.site-header .toggle-button:before {
.header-toggle-buttons .toggle-button:before {
content: "\f002";
font-family: FontAwesome;
font-weight: normal;
font-stretch: normal;
font-style: normal;
font-variant: normal;
-webkit-font-smoothing: antialiased;
font-size: 28px;
font-size: 2.8rem;
line-height: 1;
}
.site-header .toggle-button.nav-toggle:before {
.header-toggle-buttons .toggle-button.nav-toggle:before {
content: "\f0c9";
}
.big-button-nav-toggle .header-toggle-buttons .nav-toggle {
display: block;
background-color: #333;
color: #fff;
margin-left: 0;
font-size: 16px;
font-size: 1.6rem;
padding: 15px 26px;
padding: 1.5rem 2.6rem;
margin: 0 20px;
margin: 0 2rem;
text-align: center;
border-radius: 3px;
text-transform: uppercase;
-webkit-transition: all 0s;
-moz-transition: all 0s;
-ms-transition: all 0s;
-o-transition: all 0s;
transition: all 0s;
}
.big-button-nav-toggle .header-toggle-buttons .nav-toggle:before {
content: "\f0ca";
margin-right: 8px;
font-size: 16px;
font-size: 1.6rem;
}
.big-button-nav-toggle .header-toggle-buttons .targets-widget-area {
position: absolute;
right: 20px;
right: 2rem;
top: 20px;
top: 2rem;
}
.nav-primary,
/*.site-header .nav-primary,*/
.site-header .widget-area {
position: absolute;
z-index: -999;
top: 100%;
left: 0;
right: 0;
max-height: 0;
opacity: 0;
filter: alpha(opacity=0);
box-shadow: 0 4px 8px 1px rgba(0,0,0,0.4);
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
-webkit-transition: all .5s ease, padding 0s .5s;
-moz-transition: all .5s ease, padding 0s .5s;
-ms-transition: all .5s ease, padding 0s .5s;
-o-transition: all .5s ease, padding 0s .5s;
transition: all .5s ease, padding 0s .5s;
-webkit-transition: opacity 0.25s ease, z-index 0s 0.25s;
-moz-transition: opacity 0.25s ease, z-index 0s 0.25s;
-ms-transition: opacity 0.25s ease, z-index 0s 0.25s;
-o-transition: opacity 0.25s ease, z-index 0s 0.25s;
transition: opacity 0.25s ease, z-index 0s 0.25s;
}
.site-container > .nav-primary {
@@ -1440,17 +1460,15 @@ Site Header
.nav-primary.open,
.widget-area.open {
z-index: 50;
max-height: 9999px;
opacity: 1;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
-webkit-transition: opacity .5s ease, padding 0s 0s;
-moz-transition: opacity .5s ease, padding 0s 0s;
-ms-transition: opacity .5s ease, padding 0s 0s;
-o-transition: opacity .5s ease, padding 0s 0s;
transition: opacity .5s ease, padding 0s 0s;
filter: alpha(opacity=100);
-webkit-transition: z-index 0s ease, opacity 0.25s 0s;
-moz-transition: z-index 0s ease, opacity 0.25s 0s;
-ms-transition: z-index 0s ease, opacity 0.25s 0s;
-o-transition: z-index 0s ease, opacity 0.25s 0s;
transition: z-index 0s ease, opacity 0.25s 0s;
}
/*
Site Navigation
---------------------------------------------------------------------------------------------------- */
@@ -1593,6 +1611,12 @@ Site Navigation
padding-right: 5rem;
}
.big-button-nav-toggle .nav-primary {
margin: 4px 20px 0;
margin: 0.4rem 2rem 0;
border-radius: 3px;
box-shadow: none;
}
/* Navigation Extras
--------------------------------------------- */
@@ -1622,8 +1646,10 @@ Site Navigation
}
.genesis-nav-menu > .right .search-form {
display: inline-block;
display: block;
padding: 0;
margin: 0 auto;
text-align: center;
}
.genesis-nav-menu > .right input[type="submit"] {
@@ -1674,6 +1700,7 @@ Site Navigation
/* Header Primary Navigation
--------------------------------------------- */
.site-header .nav-primary {
margin: 0;
}
@@ -1682,18 +1709,10 @@ Site Navigation
padding: 0;
}
.site-header .nav-primary a:hover,
.site-header .nav-primary [class*="current-"] > a,
.site-header .nav-primary [class*="current_"] > a {
color: #333;
}
.site-header .right {
padding-right: 0;
}
/* Non jQuery Styles
--------------------------------------------- */
@@ -2036,6 +2055,19 @@ Site Footer
General Components
---------------------------------------------------------------------------------------------------- */
/* jQuery UI
--------------------------------------------- */
/* Datepicker */
table.ui-datepicker-calendar {
line-height: 1;
}
.ui-datepicker select {
width: auto;
}
/* Search Form
--------------------------------------------- */
@@ -2224,6 +2256,7 @@ Media Queries
/* Header Toggle Styles
--------------------------------------------- */
.nav-primary,
.site-header .nav-primary,
.site-header .widget-area {
@@ -2242,11 +2275,11 @@ Media Queries
background-color: transparent;
}
.site-header .toggle-button {
.header-toggle-buttons .toggle-button,
.big-button-nav-toggle .header-toggle-buttons .toggle-button.nav-toggle {
display: none;
}
/* Content
--------------------------------------------- */
@@ -2481,7 +2514,7 @@ Media Queries
--------------------------------------------- */
.genesis-nav-menu > .right {
display: inline-block;
display: none;
float: right;
border-top: none;
}
@@ -2491,14 +2524,15 @@ Media Queries
margin: 0 0 0 2rem;
}
.genesis-nav-menu > .search form {
padding-right: 0;
}
.genesis-nav-menu > .right input[type="submit"] {
display: inline-block;
}
.genesis-nav-menu > .right .search-form {
display: inline-block;
padding: 8px 0;
}
/* Sub Menus
--------------------------------------------- */
@@ -2525,6 +2559,11 @@ Media Queries
margin-left: 8px;
font-family: FontAwesome;
font-size: .6em;
font-weight: normal;
font-stretch: normal;
font-style: normal;
font-variant: normal;
-webkit-font-smoothing: antialiased;
}
.genesis-nav-menu ul .parent > a:after {
@@ -2534,6 +2573,11 @@ Media Queries
margin: 0;
font-family: FontAwesome;
font-size: .8em;
font-weight: normal;
font-stretch: normal;
font-style: normal;
font-variant: normal;
-webkit-font-smoothing: antialiased;
line-height: 1.5;
}
@@ -2553,8 +2597,17 @@ Media Queries
margin-left: -1px;
}
/* Primary Navigation
--------------------------------------------- */
.big-button-nav-toggle .nav-primary {
margin: 0;
border-radius: 0;
}
/* Header Primary Navigation
--------------------------------------------- */
.site-header .nav-primary {
background-color: transparent;
text-align: right;
@@ -2570,6 +2623,16 @@ Media Queries
padding: 0.6em 1.2em;
}
.site-header .nav-primary .menu > li:last-of-type:not(.right) {
padding-right: 0;
}
.site-header .nav-primary a:hover,
.site-header .nav-primary [class*="current-"] > a,
.site-header .nav-primary [class*="current_"] > a {
color: #333;
}
/* Plugins
--------------------------------------------- */