Merge pull request #40 from MIGHTYminnow/dev

Version 2.2.0
This commit is contained in:
Braad
2015-09-15 12:32:47 -07:00
6 changed files with 350 additions and 247 deletions
+1 -4
View File
@@ -30,9 +30,6 @@ require_once dirname( __FILE__ ) . '/includes/widget-areas/widget-areas.php';
// Plugin activation class. // Plugin activation class.
require_once dirname( __FILE__ ) . '/lib/class-tgm-plugin-activation.php'; 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. // Dev utility functions.
require_once dirname( __FILE__ ) . '/includes/utilities/utilities.php'; require_once dirname( __FILE__ ) . '/includes/utilities/utilities.php';
@@ -52,7 +49,7 @@ function trestle_theme_setup() {
// Child theme definitions (do not remove). // Child theme definitions (do not remove).
define( 'TRESTLE_THEME_NAME', 'Trestle' ); define( 'TRESTLE_THEME_NAME', 'Trestle' );
define( 'TRESTLE_THEME_URL', 'http://demo.mightyminnow.com/theme/trestle/' ); define( 'TRESTLE_THEME_URL', 'http://demo.mightyminnow.com/theme/trestle/' );
define( 'TRESTLE_THEME_VERSION', '2.1.1' ); define( 'TRESTLE_THEME_VERSION', '2.2.0' );
define( 'TRESTLE_SETTINGS_FIELD', 'trestle-settings' ); define( 'TRESTLE_SETTINGS_FIELD', 'trestle-settings' );
// Setup default theme settings. // Setup default theme settings.
+47 -14
View File
@@ -18,20 +18,20 @@ function trestle_settings_defaults() {
// Trestle default key/value pairs. // Trestle default key/value pairs.
$trestle_defaults = array( $trestle_defaults = array(
'layout' => 'solid', 'layout' => 'solid',
'logo_url' => '', 'logo_id' => '',
'logo_url_mobile' => '', 'logo_id_mobile' => '',
'favicon_url' => '', 'favicon_url' => '',
'nav_primary_location' => 'full', 'nav_primary_location' => 'full',
'mobile_nav_toggle' => 'small-icon', 'mobile_nav_toggle' => 'small-icon',
'search_in_nav' => '', 'search_in_nav' => '',
'read_more_text' => __( 'Read More »', 'trestle' ), 'read_more_text' => __( 'Read More »', 'trestle' ),
'revisions_number' => 3, 'revisions_number' => 3,
'footer_widgets_number' => 3, 'footer_widgets_number' => 3,
'external_link_icons' => 0, 'external_link_icons' => 0,
'email_link_icons' => 0, 'email_link_icons' => 0,
'pdf_link_icons' => 0, 'pdf_link_icons' => 0,
'doc_link_icons' => 0, 'doc_link_icons' => 0,
); );
// Populate Trestle settings with default values if they don't yet exist. // Populate Trestle settings with default values if they don't yet exist.
@@ -95,6 +95,33 @@ function trestle_admin_actions() {
} }
add_filter( 'tiny_mce_before_init', 'trestle_tiny_mce_before_init' );
/**
* Add custom classes to the body of TinyMCE previews.
*
* @since 2.2.0
*/
function trestle_tiny_mce_before_init( $init_array ) {
global $post;
$screen = get_current_screen();
// If we're on an edit screen, add an appropriate 'post-id-XX' or 'page-id-XX'.
if ( is_object( $screen ) && 'edit' == $screen->parent_base ) {
// Custom post types always use 'post', so we only need to handle pages.
$post_type = ( 'page' == $post->post_type ) ? 'page' : 'post';
$init_array['body_class'] .= sprintf( ' %s-id-%s',
$post_type,
$post->ID
);
}
return $init_array;
}
add_action( 'tgmpa_register', 'trestle_register_required_plugins' ); add_action( 'tgmpa_register', 'trestle_register_required_plugins' );
/** /**
* Loads required & recommended plugins. * Loads required & recommended plugins.
@@ -183,6 +210,12 @@ function trestle_register_required_plugins() {
'required' => false, 'required' => false,
), ),
array(
'name' => 'RICG Responsive Images',
'slug' => 'ricg-responsive-images',
'required' => false,
),
array( array(
'name' => 'Widget Context', 'name' => 'Widget Context',
'slug' => 'widget-context', 'slug' => 'widget-context',
+135 -132
View File
@@ -25,8 +25,8 @@ function trestle_customizer_controls( $wp_customize ) {
$wp_customize->add_section( $wp_customize->add_section(
'trestle_settings_section', 'trestle_settings_section',
array( array(
'title' => __( 'Trestle Settings', 'trestle' ), 'title' => __( 'Trestle Settings', 'trestle' ),
'priority' => 160, 'priority' => 160,
) )
); );
@@ -34,65 +34,67 @@ function trestle_customizer_controls( $wp_customize ) {
$wp_customize->add_setting( $wp_customize->add_setting(
'trestle-settings[layout]', 'trestle-settings[layout]',
array( array(
'default' => trestle_get_option( 'layout' ), 'default' => trestle_get_option( 'layout' ),
'type' => 'option', 'type' => 'option',
'capability' => 'edit_theme_options', 'capability' => 'edit_theme_options',
) )
); );
$wp_customize->add_control( $wp_customize->add_control(
'trestle_layout_control', 'trestle_layout_control',
array( array(
'section' => 'trestle_settings_section', 'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[layout]', 'settings' => 'trestle-settings[layout]',
'label' => __( 'Layout', 'trestle' ), 'label' => __( 'Layout', 'trestle' ),
'type' => 'radio', 'type' => 'radio',
'choices' => array( 'choices' => array(
'bubble' => __( 'Bubble', 'trestle' ), 'bubble' => __( 'Bubble', 'trestle' ),
'solid' => __( 'Solid', 'trestle' ), 'solid' => __( 'Solid', 'trestle' ),
) )
) )
); );
// Upload a logo. // Upload a logo.
$wp_customize->add_setting( $wp_customize->add_setting(
'trestle-settings[logo_url]', 'trestle-settings[logo_id]',
array( array(
'default' => trestle_get_option( 'logo_url' ), 'default' => trestle_get_option( 'logo_id' ),
'type' => 'option', 'type' => 'option',
'capability' => 'edit_theme_options', 'capability' => 'edit_theme_options',
'sanitize_callback' => 'esc_url_raw', 'sanitize_callback' => 'absint',
) )
); );
$wp_customize->add_control( $wp_customize->add_control(
new WP_Customize_Image_Control( new WP_Customize_Media_Control(
$wp_customize, $wp_customize,
'trestle_logo_control', 'trestle_logo_control',
array( array(
'label' => __( 'Upload a logo', 'trestle' ), 'label' => __( 'Upload a logo', 'trestle' ),
'section' => 'trestle_settings_section', 'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[logo_url]', 'settings' => 'trestle-settings[logo_id]',
'mime_type' => 'image',
) )
) )
); );
// Upload a mobile logo. // Upload a mobile logo.
$wp_customize->add_setting( $wp_customize->add_setting(
'trestle-settings[logo_url_mobile]', 'trestle-settings[logo_id_mobile]',
array( array(
'default' => trestle_get_option( 'logo_url_mobile' ), 'default' => trestle_get_option( 'logo_id_mobile' ),
'type' => 'option', 'type' => 'option',
'capability' => 'edit_theme_options', 'capability' => 'edit_theme_options',
'sanitize_callback' => 'esc_url_raw', 'sanitize_callback' => 'absint',
) )
); );
$wp_customize->add_control( $wp_customize->add_control(
new WP_Customize_Image_Control( new WP_Customize_Media_Control(
$wp_customize, $wp_customize,
'trestle_mobile_logo_control', 'trestle_mobile_logo_control',
array( array(
'label' => __( 'Upload a mobile logo', 'trestle' ), 'label' => __( 'Upload a mobile logo', 'trestle' ),
'section' => 'trestle_settings_section', 'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[logo_url_mobile]', 'settings' => 'trestle-settings[logo_id_mobile]',
'mime_type' => 'image',
) )
) )
); );
@@ -101,10 +103,10 @@ function trestle_customizer_controls( $wp_customize ) {
$wp_customize->add_setting( $wp_customize->add_setting(
'trestle-settings[favicon_url]', 'trestle-settings[favicon_url]',
array( array(
'default' => trestle_get_option( 'favicon_url' ), 'default' => trestle_get_option( 'favicon_url' ),
'type' => 'option', 'type' => 'option',
'capability' => 'edit_theme_options', 'capability' => 'edit_theme_options',
'sanitize_callback' => 'esc_url_raw', 'sanitize_callback' => 'esc_url_raw',
) )
); );
$wp_customize->add_control( $wp_customize->add_control(
@@ -112,9 +114,9 @@ function trestle_customizer_controls( $wp_customize ) {
$wp_customize, $wp_customize,
'trestle_favicon_control', 'trestle_favicon_control',
array( array(
'label' => __( 'Upload a favicon', 'trestle' ), 'label' => __( 'Upload a favicon', 'trestle' ),
'section' => 'trestle_settings_section', 'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[favicon_url]', 'settings' => 'trestle-settings[favicon_url]',
) )
) )
); );
@@ -123,21 +125,21 @@ function trestle_customizer_controls( $wp_customize ) {
$wp_customize->add_setting( $wp_customize->add_setting(
'trestle-settings[nav_primary_location]', 'trestle-settings[nav_primary_location]',
array( array(
'default' => trestle_get_option( 'nav_primary_location' ), 'default' => trestle_get_option( 'nav_primary_location' ),
'type' => 'option', 'type' => 'option',
'capability' => 'edit_theme_options', 'capability' => 'edit_theme_options',
) )
); );
$wp_customize->add_control( $wp_customize->add_control(
'trestle_nav_primary_location_control', 'trestle_nav_primary_location_control',
array( array(
'section' => 'trestle_settings_section', 'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[nav_primary_location]', 'settings' => 'trestle-settings[nav_primary_location]',
'label' => __( 'Menu style', 'trestle' ), 'label' => __( 'Menu style', 'trestle' ),
'type' => 'select', 'type' => 'select',
'choices' => array( 'choices' => array(
'full' => __( 'Full Width', 'trestle' ), 'full' => __( 'Full Width', 'trestle' ),
'header' => __( 'Header Right', 'trestle' ), 'header' => __( 'Header Right', 'trestle' ),
) )
) )
); );
@@ -146,9 +148,9 @@ function trestle_customizer_controls( $wp_customize ) {
$wp_customize->add_setting( $wp_customize->add_setting(
'trestle-settings[mobile_nav_toggle]', 'trestle-settings[mobile_nav_toggle]',
array( array(
'default' => trestle_get_option( 'mobile_nav_toggle' ), 'default' => trestle_get_option( 'mobile_nav_toggle' ),
'type' => 'option', 'type' => 'option',
'capability' => 'edit_theme_options', 'capability' => 'edit_theme_options',
) )
); );
$wp_customize->add_control( $wp_customize->add_control(
@@ -159,8 +161,8 @@ function trestle_customizer_controls( $wp_customize ) {
'label' => __( 'Mobile Menu Toggle', 'trestle' ), 'label' => __( 'Mobile Menu Toggle', 'trestle' ),
'type' => 'select', 'type' => 'select',
'choices' => array( 'choices' => array(
'small-icon' => __( 'Small Icon', 'trestle' ), 'small-icon' => __( 'Small Icon', 'trestle' ),
'big-button' => __( 'Big Button', 'trestle' ), 'big-button' => __( 'Big Button', 'trestle' ),
) )
) )
); );
@@ -169,9 +171,9 @@ function trestle_customizer_controls( $wp_customize ) {
$wp_customize->add_setting( $wp_customize->add_setting(
'trestle-settings[search_in_nav]', 'trestle-settings[search_in_nav]',
array( array(
'default' => trestle_get_option( 'search_in_nav' ), 'default' => trestle_get_option( 'search_in_nav' ),
'type' => 'option', 'type' => 'option',
'capability' => 'edit_theme_options', 'capability' => 'edit_theme_options',
) )
); );
$wp_customize->add_control( $wp_customize->add_control(
@@ -180,7 +182,7 @@ function trestle_customizer_controls( $wp_customize ) {
'section' => 'trestle_settings_section', 'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[search_in_nav]', 'settings' => 'trestle-settings[search_in_nav]',
'label' => __( 'Add search to mobile navigation', 'trestle' ), 'label' => __( 'Add search to mobile navigation', 'trestle' ),
'type' => 'checkbox', 'type' => 'checkbox',
) )
); );
@@ -188,18 +190,18 @@ function trestle_customizer_controls( $wp_customize ) {
$wp_customize->add_setting( $wp_customize->add_setting(
'trestle-settings[read_more_text]', 'trestle-settings[read_more_text]',
array( array(
'default' => trestle_get_option( 'read_more_text' ), 'default' => trestle_get_option( 'read_more_text' ),
'type' => 'option', 'type' => 'option',
'capability' => 'edit_theme_options', 'capability' => 'edit_theme_options',
'sanitize_callback' => 'wp_kses_post', 'sanitize_callback' => 'wp_kses_post',
) )
); );
$wp_customize->add_control( $wp_customize->add_control(
'trestle_read_more_text_control', 'trestle_read_more_text_control',
array( array(
'section' => 'trestle_settings_section', 'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[read_more_text]', 'settings' => 'trestle-settings[read_more_text]',
'label' => __( 'Custom read more link text', 'trestle' ), 'label' => __( 'Custom read more link text', 'trestle' ),
) )
); );
@@ -207,31 +209,32 @@ function trestle_customizer_controls( $wp_customize ) {
$wp_customize->add_setting( $wp_customize->add_setting(
'trestle-settings[revisions_number]', 'trestle-settings[revisions_number]',
array( array(
'default' => trestle_get_option( 'revisions_number' ), 'default' => trestle_get_option( 'revisions_number' ),
'type' => 'option', 'type' => 'option',
'capability' => 'edit_theme_options', 'capability' => 'edit_theme_options',
'sanitize_callback' => 'absint',
) )
); );
$wp_customize->add_control( $wp_customize->add_control(
'trestle_revisions_number_control', 'trestle_revisions_number_control',
array( array(
'section' => 'trestle_settings_section', 'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[revisions_number]', 'settings' => 'trestle-settings[revisions_number]',
'label' => __( 'Number of post revisions', 'trestle' ), 'label' => __( 'Number of post revisions', 'trestle' ),
'type' => 'select', 'type' => 'select',
'choices' => array( 'choices' => array(
'-1' => __( 'Unlimited', 'trestle' ), '-1' => __( 'Unlimited', 'trestle' ),
'0' => '0', '0' => '0',
'1' => '1', '1' => '1',
'2' => '2', '2' => '2',
'3' => '3', '3' => '3',
'4' => '4', '4' => '4',
'5' => '5', '5' => '5',
'6' => '6', '6' => '6',
'7' => '7', '7' => '7',
'8' => '8', '8' => '8',
'9' => '9', '9' => '9',
'10' => '10', '10' => '10',
) )
) )
); );
@@ -240,26 +243,26 @@ function trestle_customizer_controls( $wp_customize ) {
$wp_customize->add_setting( $wp_customize->add_setting(
'trestle-settings[footer_widgets_number]', 'trestle-settings[footer_widgets_number]',
array( array(
'default' => trestle_get_option( 'footer_widgets_number' ), 'default' => trestle_get_option( 'footer_widgets_number' ),
'type' => 'option', 'type' => 'option',
'capability' => 'edit_theme_options', 'capability' => 'edit_theme_options',
) )
); );
$wp_customize->add_control( $wp_customize->add_control(
'trestle_footer_widgets_number_control', 'trestle_footer_widgets_number_control',
array( array(
'section' => 'trestle_settings_section', 'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[footer_widgets_number]', 'settings' => 'trestle-settings[footer_widgets_number]',
'label' => __( 'Number of footer widgets', 'trestle' ), 'label' => __( 'Number of footer widgets', 'trestle' ),
'type' => 'select', 'type' => 'select',
'choices' => array( 'choices' => array(
'0' => '0', '0' => '0',
'1' => '1', '1' => '1',
'2' => '2', '2' => '2',
'3' => '3', '3' => '3',
'4' => '4', '4' => '4',
'5' => '5', '5' => '5',
'6' => '6', '6' => '6',
) )
) )
); );
@@ -268,17 +271,17 @@ function trestle_customizer_controls( $wp_customize ) {
$wp_customize->add_setting( $wp_customize->add_setting(
'trestle-settings[link_icons_title]', 'trestle-settings[link_icons_title]',
array( array(
'default' => '', 'default' => '',
'type' => 'option', 'type' => 'option',
) )
); );
$wp_customize->add_control( $wp_customize->add_control(
'trestle_link_icons_title', 'trestle_link_icons_title',
array( array(
'section' => 'trestle_settings_section', 'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[link_icons_title]', 'settings' => 'trestle-settings[link_icons_title]',
'label' => __( 'Icon links', 'trestle' ), 'label' => __( 'Icon links', 'trestle' ),
'type' => 'hidden', 'type' => 'hidden',
) )
); );
@@ -286,18 +289,18 @@ function trestle_customizer_controls( $wp_customize ) {
$wp_customize->add_setting( $wp_customize->add_setting(
'trestle-settings[external_link_icons]', 'trestle-settings[external_link_icons]',
array( array(
'default' => trestle_get_option( 'external_link_icons' ), 'default' => trestle_get_option( 'external_link_icons' ),
'type' => 'option', 'type' => 'option',
'capability' => 'edit_theme_options', 'capability' => 'edit_theme_options',
) )
); );
$wp_customize->add_control( $wp_customize->add_control(
'trestle_external_link_icons', 'trestle_external_link_icons',
array( array(
'section' => 'trestle_settings_section', 'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[external_link_icons]', 'settings' => 'trestle-settings[external_link_icons]',
'label' => __( 'Add icons to external links', 'trestle' ), 'label' => __( 'Add icons to external links', 'trestle' ),
'type' => 'checkbox', 'type' => 'checkbox',
) )
); );
@@ -305,18 +308,18 @@ function trestle_customizer_controls( $wp_customize ) {
$wp_customize->add_setting( $wp_customize->add_setting(
'trestle-settings[email_link_icons]', 'trestle-settings[email_link_icons]',
array( array(
'default' => trestle_get_option( 'email_link_icons' ), 'default' => trestle_get_option( 'email_link_icons' ),
'type' => 'option', 'type' => 'option',
'capability' => 'edit_theme_options', 'capability' => 'edit_theme_options',
) )
); );
$wp_customize->add_control( $wp_customize->add_control(
'trestle_email_link_icons', 'trestle_email_link_icons',
array( array(
'section' => 'trestle_settings_section', 'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[email_link_icons]', 'settings' => 'trestle-settings[email_link_icons]',
'label' => __( 'Add icons to email links', 'trestle' ), 'label' => __( 'Add icons to email links', 'trestle' ),
'type' => 'checkbox', 'type' => 'checkbox',
) )
); );
@@ -324,18 +327,18 @@ function trestle_customizer_controls( $wp_customize ) {
$wp_customize->add_setting( $wp_customize->add_setting(
'trestle-settings[pdf_link_icons]', 'trestle-settings[pdf_link_icons]',
array( array(
'default' => trestle_get_option( 'pdf_link_icons' ), 'default' => trestle_get_option( 'pdf_link_icons' ),
'type' => 'option', 'type' => 'option',
'capability' => 'edit_theme_options', 'capability' => 'edit_theme_options',
) )
); );
$wp_customize->add_control( $wp_customize->add_control(
'trestle_pdf_link_icons', 'trestle_pdf_link_icons',
array( array(
'section' => 'trestle_settings_section', 'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[pdf_link_icons]', 'settings' => 'trestle-settings[pdf_link_icons]',
'label' => __( 'Add icons to .pdf links', 'trestle' ), 'label' => __( 'Add icons to .pdf links', 'trestle' ),
'type' => 'checkbox', 'type' => 'checkbox',
) )
); );
@@ -343,18 +346,18 @@ function trestle_customizer_controls( $wp_customize ) {
$wp_customize->add_setting( $wp_customize->add_setting(
'trestle-settings[doc_link_icons]', 'trestle-settings[doc_link_icons]',
array( array(
'default' => trestle_get_option( 'doc_link_icons' ), 'default' => trestle_get_option( 'doc_link_icons' ),
'type' => 'option', 'type' => 'option',
'capability' => 'edit_theme_options', 'capability' => 'edit_theme_options',
) )
); );
$wp_customize->add_control( $wp_customize->add_control(
'trestle_doc_link_icons', 'trestle_doc_link_icons',
array( array(
'section' => 'trestle_settings_section', 'section' => 'trestle_settings_section',
'settings' => 'trestle-settings[doc_link_icons]', 'settings' => 'trestle-settings[doc_link_icons]',
'label' => __( 'Add icons to .doc links', 'trestle' ), 'label' => __( 'Add icons to .doc links', 'trestle' ),
'type' => 'checkbox', 'type' => 'checkbox',
) )
); );
+120 -19
View File
@@ -55,6 +55,9 @@ add_action( 'init', 'trestle_load_bfa' );
*/ */
function trestle_load_bfa() { function trestle_load_bfa() {
// 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. // Set the library initialization args.
$args = array( $args = array(
'version' => 'latest', 'version' => 'latest',
@@ -192,7 +195,7 @@ function trestle_body_classes( $classes ) {
} }
// Add logo class. // Add logo class.
if ( trestle_get_option( 'logo_url' ) || trestle_get_option( 'logo_url_mobile' ) ) { if ( trestle_get_option( 'logo_id' ) || trestle_get_option( 'logo_id_mobile' ) ) {
$classes[] = 'has-logo'; $classes[] = 'has-logo';
} }
@@ -213,46 +216,59 @@ add_filter( 'genesis_seo_title', 'trestle_do_logos', 10, 3 );
*/ */
function trestle_do_logos( $title, $inside, $wrap ) { function trestle_do_logos( $title, $inside, $wrap ) {
$logo_url = trestle_get_option( 'logo_url' ); $logo_id = trestle_get_option( 'logo_id' );
$logo_url_mobile = trestle_get_option( 'logo_url_mobile' ); $logo_id_mobile = trestle_get_option( 'logo_id_mobile' );
$logo_html = ''; $logo_html = '';
// Regular logo. // Regular logo.
if ( $logo_url ) { if ( $logo_id ) {
// Default logo class. // Default logo classes.
$classes = array('logo-full'); $classes = array(
'logo',
'logo-full'
);
// If no mobile logo is specified, make regular logo act as mobile logo too. // If no mobile logo is specified, make regular logo act as mobile logo too.
if( ! $logo_url_mobile ) if( ! $logo_id_mobile ) {
$classes[] = 'show'; $classes[] = 'show';
}
$logo_html .= sprintf( '<img class="logo %s" alt="%s" src="%s" />', // Prepare the classes.
implode(' ', $classes), $logo_attr = array(
esc_attr( get_bloginfo( 'name' ) ), 'class' => implode( $classes, ' ' ),
$logo_url
); );
// Build the <img> tag.
$logo_html .= wp_get_attachment_image( $logo_id, 'full', false, $logo_attr );
} }
// Mobile logo. // Mobile logo.
if ( $logo_url_mobile ) { if ( $logo_id_mobile ) {
// Default mobile logo class. // Default mobile logo class.
$classes = array('logo-mobile'); $classes = array(
'logo',
'logo-mobile'
);
// If no regular logo is specified, make mobile logo act as regular logo too. // If no regular logo is specified, make mobile logo act as regular logo too.
if( ! $logo_url ) if( ! $logo_id )
$classes[] = 'show'; $classes[] = 'show';
$logo_html .= sprintf( '<img class="logo %s" alt="%s" src="%s" />', // Prepare the classes.
implode(' ', $classes), $logo_attr = array(
esc_attr( get_bloginfo( 'name' ) ), 'class' => implode( $classes, ' ' ),
$logo_url_mobile
); );
// Build the <img> tag.
$logo_html .= wp_get_attachment_image( $logo_id_mobile, 'full', false, $logo_attr );
} }
if ( $logo_html ) { if ( $logo_html ) {
$inside .= sprintf( '<a href="%s" title="%s">%s</a>', $inside .= sprintf( '<a href="%s" title="%s" class="logos">%s</a>',
trailingslashit( home_url() ), trailingslashit( home_url() ),
esc_attr( get_bloginfo( 'name' ) ), esc_attr( get_bloginfo( 'name' ) ),
$logo_html $logo_html
@@ -315,6 +331,26 @@ function trestle_custom_nav_extras( $nav_items, stdClass $menu_args ) {
* Posts & Pages * 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 ); add_filter( 'wp_revisions_to_keep', 'trestle_update_revisions_number', 10, 2 );
/** /**
* Sets the number of post revisions. * Sets the number of post revisions.
@@ -382,3 +418,68 @@ function trestle_read_more_link( $default_text ) {
return $default_text; return $default_text;
} }
} }
/*===========================================
* Helper Functions
===========================================*/
/**
* Check if image has specified image size.
*
* @since 2.2.0
*
* @param int $image_id ID of image to check.
* @param string $image_size Slug of image size to check for.
*
* @return true|false Whether or not the image has the specified size generated.
*/
function trestle_image_has_size( $image_id, $image_size = null ) {
global $_wp_additional_image_sizes;
// Return with error if no image_size is specified.
if ( ! $image_size ) {
return new WP_Error( 'no_image_size_specified', __( 'Please specify an image size.', 'trestle' ) );
}
// Get the attributes for the specified image size.
$image_size_atts = $_wp_additional_image_sizes[ $image_size ];
// Get data for specified image ID and size.
$img_data = wp_get_attachment_image_src( $image_id, $image_size );
// Check if the dimensions match.
if ( $img_data[1] == $image_size_atts['width'] && $img_data[2] == $image_size_atts['height'] ) {
return true;
}
return false;
}
/**
* Check if post is, or is a child of, a target post.
*
* @since 1.0.0
*
* @param string $post_id Post ID to check.
* @param string $target_id Target post ID to check against.
*
* @return true|false
*/
function trestle_is_current_or_descendant_post( $post_id = '', $target_id = '' ) {
// If the current post is the target post, return true.
if ( $post_id == $target_id ) {
return true;
}
// If the current post is a descendant of the target post.
if ( in_array( $target_id, get_post_ancestors( $post_id ) ) ) {
return true;
}
return false;
}
+2 -2
View File
@@ -107,8 +107,8 @@ jQuery( document ).ready( function( $ ) {
var openIcon = '-'; var openIcon = '-';
// Insert the icons into the nav where appropriate. // 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:not( [class*="current"] ) > 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>' ); $( '.nav-primary' ).find( '.genesis-nav-menu .parent[class*="current"] > a' ).after( '<a class="sub-icon" href="#">' + openIcon + '</a>' );
// Mobile navigation expand/contract functionality. // Mobile navigation expand/contract functionality.
$( '.sub-icon' ).click( function( event ) { $( '.sub-icon' ).click( function( event ) {
+45 -76
View File
@@ -5,7 +5,7 @@
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. 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: MIGHTYminnow
Author URI: http://www.mightyminnow.com/ Author URI: http://www.mightyminnow.com/
Version: 2.1.1 Version: 2.2.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 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 Text Domain: trestle
GitHub Theme URI: MIGHTYminnow/trestle GitHub Theme URI: MIGHTYminnow/trestle
@@ -129,7 +129,6 @@ input[type="search"] {
display: table; display: table;
} }
/* /*
Defaults Defaults
---------------------------------------------------------------------------------------------------- */ ---------------------------------------------------------------------------------------------------- */
@@ -151,6 +150,10 @@ body {
line-height: 1.625; line-height: 1.625;
} }
body.bubble {
background-color: #f5f5f5;
}
/* Used in the editor */ /* Used in the editor */
body.mce-content-body { body.mce-content-body {
width: auto; width: auto;
@@ -158,10 +161,7 @@ body.mce-content-body {
float: none; float: none;
-webkit-font-smoothing: auto !important; -webkit-font-smoothing: auto !important;
font-smoothing: auto !important; font-smoothing: auto !important;
} background: #fff;
body.bubble {
background-color: #f5f5f5;
} }
a, a,
@@ -609,46 +609,6 @@ body .red:hover {
border-color: #555; 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,
.arrow-left:before {
display: inline-block;
font-family: FontAwesome;
font-weight: normal;
font-stretch: normal;
font-style: normal;
font-variant: normal;
line-height: 1;
-webkit-font-smoothing: antialiased;
}
.arrow-right:after {
content: "\00a0\00a0\f0a9";
}
.arrow-left:before {
content: "\f0a8\00a0\00a0";
}
/* Tables /* Tables
--------------------------------------------- */ --------------------------------------------- */
@@ -681,7 +641,6 @@ td {
padding: 0.6rem 0; padding: 0.6rem 0;
} }
/* /*
Structure and Layout Structure and Layout
---------------------------------------------------------------------------------------------------- */ ---------------------------------------------------------------------------------------------------- */
@@ -721,7 +680,6 @@ Structure and Layout
padding: 20px; padding: 20px;
padding: 2rem; padding: 2rem;
background-color: transparent; background-color: transparent;
} }
.entry, .entry,
@@ -740,6 +698,7 @@ Structure and Layout
/* Bubble Layout /* Bubble Layout
--------------------------------------------- */ --------------------------------------------- */
.bubble .entry, .bubble .entry,
.bubble .sidebar .widget, .bubble .sidebar .widget,
.bubble .ez-widget-area, .bubble .ez-widget-area,
@@ -831,7 +790,6 @@ Structure and Layout
width: 100%; width: 100%;
} }
/* /*
Common Classes Common Classes
---------------------------------------------------------------------------------------------------- */ ---------------------------------------------------------------------------------------------------- */
@@ -908,6 +866,35 @@ img.alignright,
text-align: center; text-align: center;
} }
/* Text meant only for screen readers. */
.screen-reader-text {
clip: rect(1px, 1px, 1px, 1px);
position: absolute !important;
height: 1px;
width: 1px;
overflow: hidden;
}
.screen-reader-text:focus {
background-color: #f1f1f1;
border-radius: 3px;
box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
clip: auto !important;
color: #21759b;
display: block;
font-size: 14px;
font-size: 0.875rem;
font-weight: bold;
height: auto;
left: 5px;
line-height: normal;
padding: 15px 23px 14px;
text-decoration: none;
top: 5px;
width: auto;
z-index: 100000; /* Above WP toolbar. */
}
/* Genesis /* Genesis
--------------------------------------------- */ --------------------------------------------- */
@@ -981,7 +968,6 @@ img.alignright,
margin-bottom: 2.4rem; margin-bottom: 2.4rem;
} }
/* /*
Plugins & Widgets Plugins & Widgets
---------------------------------------------------------------------------------------------------- */ ---------------------------------------------------------------------------------------------------- */
@@ -1076,7 +1062,6 @@ Plugins & Widgets
margin-bottom: 28px; margin-bottom: 28px;
} }
/* Gravity Forms /* Gravity Forms
--------------------------------------------- */ --------------------------------------------- */
@@ -1110,7 +1095,7 @@ div.gform_wrapper form .gfield_checkbox li {
margin: 0; margin: 0;
} }
div.gform_wrapper ul.gfield_radio li { /* Prevent radio optoin from being cut off by default GF CSS */ div.gform_wrapper ul.gfield_radio li { /* Prevent radio option from being cut off by default GF CSS */
padding-left: 1px !important; padding-left: 1px !important;
} }
@@ -1145,7 +1130,6 @@ img#wpstats {
display: none; display: none;
} }
/* Jetpack - Blog Subscriptions /* Jetpack - Blog Subscriptions
--------------------------------------------- */ --------------------------------------------- */
@@ -1318,7 +1302,6 @@ th a.wpv-header-desc:after {
top: auto; top: auto;
} }
/* /*
Site Header Site Header
---------------------------------------------------------------------------------------------------- */ ---------------------------------------------------------------------------------------------------- */
@@ -1375,7 +1358,6 @@ Site Header
top: -9999px; top: -9999px;
} }
/* Logo /* Logo
--------------------------------------------- */ --------------------------------------------- */
@@ -1387,7 +1369,6 @@ Site Header
display: inline-block !important; display: inline-block !important;
} }
/* Header Widget Areas /* Header Widget Areas
--------------------------------------------- */ --------------------------------------------- */
@@ -1406,7 +1387,6 @@ Site Header
text-align: center; text-align: center;
} }
/* Header Toggle Styles /* Header Toggle Styles
--------------------------------------------- */ --------------------------------------------- */
@@ -1587,10 +1567,10 @@ Site Navigation
background-color: #fff; background-color: #fff;
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
-webkit-transition: opacity .4s ease-in-out; -webkit-transition: opacity .4s ease-in-out;
-moz-transition: opacity .4s ease-in-out; -moz-transition: opacity .4s ease-in-out;
-ms-transition: opacity .4s ease-in-out; -ms-transition: opacity .4s ease-in-out;
-o-transition: opacity .4s ease-in-out; -o-transition: opacity .4s ease-in-out;
transition: opacity .4s ease-in-out; transition: opacity .4s ease-in-out;
} }
.genesis-nav-menu [class*="current-"] > ul, .genesis-nav-menu [class*="current-"] > ul,
@@ -1636,7 +1616,6 @@ Site Navigation
text-align: center; text-align: center;
} }
/* Primary Navigation /* Primary Navigation
--------------------------------------------- */ --------------------------------------------- */
@@ -1696,7 +1675,6 @@ Site Navigation
margin: 0 0 0 0.5em; margin: 0 0 0 0.5em;
} }
/* Secondary Navigation /* Secondary Navigation
--------------------------------------------- */ --------------------------------------------- */
@@ -1710,7 +1688,6 @@ Site Navigation
color: #111; color: #111;
} }
/* Header Navigation /* Header Navigation
--------------------------------------------- */ --------------------------------------------- */
@@ -1737,7 +1714,6 @@ Site Navigation
display: none; display: none;
} }
/* Header Primary Navigation /* Header Primary Navigation
--------------------------------------------- */ --------------------------------------------- */
@@ -1766,7 +1742,6 @@ Site Navigation
display: block; display: block;
} }
/* /*
Content Area Content Area
---------------------------------------------------------------------------------------------------- */ ---------------------------------------------------------------------------------------------------- */
@@ -1846,7 +1821,6 @@ Content Area
margin-left: 0; margin-left: 0;
} }
.archive-pagination li { .archive-pagination li {
display: inline; display: inline;
} }
@@ -1863,7 +1837,6 @@ Content Area
padding: 0.8rem 1.2rem; padding: 0.8rem 1.2rem;
} }
.pagination-next a:hover, .pagination-next a:hover,
.pagination-previous a:hover, .pagination-previous a:hover,
.archive-pagination li a:hover, .archive-pagination li a:hover,
@@ -1959,7 +1932,6 @@ li.comment {
padding: 2.4rem; padding: 2.4rem;
} }
/* /*
Sidebars Sidebars
---------------------------------------------------------------------------------------------------- */ ---------------------------------------------------------------------------------------------------- */
@@ -2059,7 +2031,6 @@ Footer Widgets
border: 1px solid #ddd; border: 1px solid #ddd;
} }
/* /*
Site Footer Site Footer
---------------------------------------------------------------------------------------------------- */ ---------------------------------------------------------------------------------------------------- */
@@ -2090,7 +2061,6 @@ Site Footer
margin-bottom: 0; margin-bottom: 0;
} }
/* /*
General Components General Components
---------------------------------------------------------------------------------------------------- */ ---------------------------------------------------------------------------------------------------- */
@@ -2120,12 +2090,10 @@ table.ui-datepicker-calendar {
margin-right: -125px; margin-right: -125px;
} }
/* /*
Specific Pages Specific Pages
---------------------------------------------------------------------------------------------------- */ ---------------------------------------------------------------------------------------------------- */
/* /*
Media Queries Media Queries
---------------------------------------------------------------------------------------------------- */ ---------------------------------------------------------------------------------------------------- */
@@ -2178,6 +2146,7 @@ Media Queries
/* Responsive Tables CSS /* Responsive Tables CSS
--------------------------------------------- */ --------------------------------------------- */
@media (max-width: 600px) { @media (max-width: 600px) {
table { table {
@@ -2497,6 +2466,7 @@ Media Queries
/* Non-Mobile Navigation /* Non-Mobile Navigation
--------------------------------------------- */ --------------------------------------------- */
#menu-toggle, #menu-toggle,
.widget-area-toggle { .widget-area-toggle {
display: none; display: none;
@@ -2541,15 +2511,14 @@ Media Queries
border-bottom-width: 0; border-bottom-width: 0;
} }
/* Primary Navigation /* Primary Navigation
--------------------------------------------- */ --------------------------------------------- */
.nav-primary a { .nav-primary a {
padding-right: 20px; padding-right: 20px;
padding-right: 2rem; padding-right: 2rem;
} }
/* Navigation Extras /* Navigation Extras
--------------------------------------------- */ --------------------------------------------- */
@@ -2673,11 +2642,11 @@ Media Queries
color: #333; color: #333;
} }
/* Plugins /* Plugins
--------------------------------------------- */ --------------------------------------------- */
/* Events Manager */ /* Events Manager */
.em-calendar-wrapper .fullcalendar tr { .em-calendar-wrapper .fullcalendar tr {
display: table-row !important; display: table-row !important;
} }