mirror of
https://github.com/10h30/trestle.git
synced 2026-07-12 11:16:27 +09:00
Compare commits
17 Commits
update-bfal
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 51c177d85a | |||
| 69184c5f90 | |||
| b52e7e3387 | |||
| 59ec252bc4 | |||
| 331fd2e271 | |||
| b1d4ec9775 | |||
| 974933f5c2 | |||
| 0ba318f54a | |||
| 2b50585a14 | |||
| 4d104ab1f2 | |||
| a6b0a37771 | |||
| eb655a32e1 | |||
| c8125f0d91 | |||
| 81b17fd9b7 | |||
| 3e6432dc8d | |||
| 8cd6b7ae9b | |||
| 05448fdd0f |
+1
-1
@@ -49,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.0.1' );
|
define( 'TRESTLE_THEME_VERSION', '2.1.0' );
|
||||||
define( 'TRESTLE_SETTINGS_FIELD', 'trestle-settings' );
|
define( 'TRESTLE_SETTINGS_FIELD', 'trestle-settings' );
|
||||||
|
|
||||||
// Setup default theme settings.
|
// Setup default theme settings.
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ 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',
|
||||||
@@ -210,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',
|
||||||
|
|||||||
@@ -55,44 +55,46 @@ function trestle_customizer_controls( $wp_customize ) {
|
|||||||
|
|
||||||
// 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',
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -210,6 +212,7 @@ function trestle_customizer_controls( $wp_customize ) {
|
|||||||
'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(
|
||||||
|
|||||||
@@ -195,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';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,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
|
||||||
@@ -405,3 +418,42 @@ 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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -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 ) {
|
||||||
|
|||||||
@@ -151,6 +151,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 +162,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,
|
||||||
@@ -868,6 +869,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
|
||||||
--------------------------------------------- */
|
--------------------------------------------- */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user