added a ton of goodies - this is initial release 1.0.0

This commit is contained in:
Mickey Kay
2014-01-16 13:40:07 -08:00
parent 5fe327f54c
commit bbc4641551
26 changed files with 7516 additions and 2138 deletions
Binary file not shown.
File diff suppressed because one or more lines are too long
+1825
View File
File diff suppressed because one or more lines are too long
+1886
View File
File diff suppressed because one or more lines are too long
+45 -64
View File
@@ -1,28 +1,44 @@
<?php
/**
* Genesis Theme Setup
* @since 1.0
*
* This setup function attaches all theme functionality
* via the appropriate hooks and filters and includes
* additional theme files
* Trestle theme functionality
*
* @since 1.0.0
*
* @package Trestle
*/
add_action( 'genesis_setup' ,'trestle_theme_setup', 15 );
function trestle_theme_setup() {
/*===========================================
* Trestle theme settings
* Required Files
===========================================*/
// Trestle theme functions
require_once dirname( __FILE__ ) . '/lib/functions/theme-functions.php';
// Admin functionality
require_once dirname( __FILE__ ) . '/lib/admin/admin.php';
// Shortcodes
require_once dirname( __FILE__ ) . '/lib/shortcodes/shortcodes.php';
// Plugin activation class
require_once dirname( __FILE__ ) . '/lib/classes/class-tgm-plugin-activation.php';
/*===========================================
* Trestle 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.0' );
define( 'CHILD_THEME_VERSION', '1.0.0' );
// Load theme text domain
load_theme_textdomain( 'trestle', get_stylesheet_directory() . '/languages');
load_theme_textdomain( 'trestle', get_stylesheet_directory() . '/languages' );
// Add HTML5 markup structure
add_theme_support( 'html5' );
@@ -33,39 +49,16 @@ function trestle_theme_setup() {
// Add support for custom background
add_theme_support( 'custom-background' );
// Add support for 3-column footer widgets
add_theme_support( 'genesis-footer-widgets', 3 );
// 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 );
/*===========================================
* Required Files
===========================================*/
// Trestle theme functions
require_once dirname( __FILE__ ) . '/lib/functions/trestle-functions.php';
// Admin functionality
require_once dirname( __FILE__ ) . '/lib/admin/admin.php';
// Plugin activation class
require_once dirname( __FILE__ ) . '/lib/classes/class-tgm-plugin-activation.php';
/*===========================================
* Styles and scripts
* Header Styles & Scripts
===========================================*/
add_action( 'wp_enqueue_scripts', 'trestle_header_actions');
/*===========================================
* Load Required/Suggested Plugins
*
* Utilizes TGM Plugin Activation class:
* https://github.com/thomasgriffin/TGM-Plugin-Activation
===========================================*/
add_action( 'tgmpa_register', 'trestle_register_required_plugins' );
add_action( 'wp_enqueue_scripts', 'trestle_header_actions' );
/*===========================================
@@ -75,39 +68,27 @@ function trestle_theme_setup() {
// Implement auto-nav and mobile nav button
add_action( 'init', 'trestle_nav_modifications' );
// Create / remove placeholder menu for Trestle auto nav
add_action( 'init', 'trestle_nav_placeholder' );
/*===========================================
* Posts & Pages
===========================================*/
// Setup revisions number
add_filter( 'wp_revisions_to_keep', 'trestle_update_revisions_number', 10, 2 );
// Manually control where Post Info & Meta display
add_action( 'the_post', 'trestle_post_info_meta', 0 );
/*===========================================
* Actions & Filters
* General Actions & Filters
===========================================*/
// Add body classes
add_filter( 'body_class', 'trestle_body_classes' );
/*===========================================
* Footer
===========================================*/
// Add Trestle custom footer attribute to Mm
add_filter( 'genesis_footer_output', 'trestle_custom_footer' );
/*===========================================
* Admin Functionality
===========================================*/
// Trestle admin scripts and styles
add_action( 'admin_enqueue_scripts', 'trestle_admin_actions' );
// Trestle default settings
add_filter( 'genesis_theme_settings_defaults', 'trestle_custom_defaults' );
// Sanitize settings
add_action( 'genesis_settings_sanitizer_init', 'trestle_register_social_sanitization_filters' );
// Register Trestle settings metabox
add_action( 'genesis_theme_settings_metaboxes', 'trestle_register_settings_box' );
// Do custom Read More text
add_filter( 'excerpt_more', 'trestle_read_more_link' );
add_filter( 'get_the_content_more_link', 'trestle_read_more_link' );
add_filter( 'the_content_more_link', 'trestle_read_more_link' );
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 804 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 698 B

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.
+348
View File
@@ -0,0 +1,348 @@
msgid ""
msgstr ""
"Project-Id-Version: Trestle\n"
"POT-Creation-Date: 2014-01-16 11:55-0800\n"
"PO-Revision-Date: 2014-01-16 11:55-0800\n"
"Last-Translator: Mickey <mickey@mightyminnow.com>\n"
"Language-Team: MIGHTYminnow <info@mightyminnow.com>\n"
"Language: en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.6.3\n"
"X-Poedit-Basepath: .\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-KeywordsList: __;_e;_x;_n\n"
"X-Poedit-SearchPath-0: ..\n"
#: ../lib/admin/admin-functions.php:38
msgid "Navigation"
msgstr ""
#: ../lib/admin/admin-functions.php:39
msgid "Read&nbsp;More&nbsp;&raquo;"
msgstr ""
#: ../lib/admin/admin-functions.php:121
msgid "Trestle Settings <small>by</small>"
msgstr ""
#: ../lib/admin/admin-functions.php:135
msgid "Layout"
msgstr ""
#: ../lib/admin/admin-functions.php:143
msgid "Primary Navigation"
msgstr ""
#: ../lib/admin/admin-functions.php:145
msgid ""
"Automatically generate nav menu (replaces custom/manual menu with auto-"
"generated menu)"
msgstr ""
#: ../lib/admin/admin-functions.php:146
msgid "Include home link"
msgstr ""
#: ../lib/admin/admin-functions.php:149
msgid "Text for mobile navigation button (shortcodes can be included):"
msgstr ""
#: ../lib/admin/admin-functions.php:153
msgid "Primary Navigation Extras"
msgstr ""
#: ../lib/admin/admin-functions.php:154
msgid ""
"Display custom navigation extras content (overrides standard Genesis "
"navigation extras)"
msgstr ""
#: ../lib/admin/admin-functions.php:156
msgid "Custom navigation extras text:"
msgstr ""
#: ../lib/admin/admin-functions.php:160
msgid "Blog/Posts"
msgstr ""
#: ../lib/admin/admin-functions.php:162
msgid "Custom read more link text"
msgstr ""
#: ../lib/admin/admin-functions.php:165
msgid "Number of post revisions"
msgstr ""
#: ../lib/admin/admin-functions.php:176
msgid "Post Info & Meta"
msgstr ""
#: ../lib/admin/admin-functions.php:177
msgid "Manually select where to show Post Info & Meta"
msgstr ""
#: ../lib/admin/admin-functions.php:180
msgid "Show Post Info on:"
msgstr ""
#: ../lib/admin/admin-functions.php:190 ../lib/admin/admin-functions.php:210
#, php-format
msgid "%s (single)"
msgstr ""
#: ../lib/admin/admin-functions.php:193 ../lib/admin/admin-functions.php:213
#, php-format
msgid "%s (archive)"
msgstr ""
#: ../lib/admin/admin-functions.php:200
msgid "Show Post Meta on:"
msgstr ""
#: ../lib/admin/admin-functions.php:221
msgid "Footer Widgets"
msgstr ""
#: ../lib/admin/admin-functions.php:223
msgid "Number"
msgstr ""
#: ../lib/admin/admin-functions.php:233
msgid "Link Icons"
msgstr ""
#: ../lib/admin/admin-functions.php:235
msgid "Add icons to external links"
msgstr ""
#: ../lib/admin/admin-functions.php:236
msgid "Add icons to email links"
msgstr ""
#: ../lib/admin/admin-functions.php:237
msgid "Add icons to .pdf links"
msgstr ""
#: ../lib/admin/admin-functions.php:238
msgid "Add icons to .doc links"
msgstr ""
#: ../lib/admin/admin-functions.php:398
#: ../lib/classes/class-tgm-plugin-activation.php:155
msgid "Install Required Plugins"
msgstr ""
#: ../lib/admin/admin-functions.php:399
#: ../lib/classes/class-tgm-plugin-activation.php:156
msgid "Install Plugins"
msgstr ""
#: ../lib/admin/admin-functions.php:400
#: ../lib/classes/class-tgm-plugin-activation.php:157
#, php-format
msgid "Installing Plugin: %s"
msgstr ""
#: ../lib/admin/admin-functions.php:401
msgid "Something went wrong with the plugin API."
msgstr ""
#: ../lib/admin/admin-functions.php:412
#: ../lib/classes/class-tgm-plugin-activation.php:169
msgid "Return to Required Plugins Installer"
msgstr ""
#: ../lib/admin/admin-functions.php:413
#: ../lib/classes/class-tgm-plugin-activation.php:171
#: ../lib/classes/class-tgm-plugin-activation.php:1840
msgid "Plugin activated successfully."
msgstr ""
#: ../lib/admin/admin-functions.php:414
#, php-format
msgid "All plugins installed and activated successfully. %s"
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:158
msgid "Something went wrong."
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:170
msgid "Return to the dashboard"
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:172
#: ../lib/classes/class-tgm-plugin-activation.php:1538
msgid "The following plugin was activated successfully:"
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:173
#, php-format
msgid "All plugins installed and activated successfully. %1$s"
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:174
msgid "Dismiss this notice"
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1085
msgid "External Link"
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1090
msgid "Private Repository"
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1093
msgid "Pre-Packaged"
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1097
msgid "WordPress Repository"
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1100
msgid "Required"
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1100
msgid "Recommended"
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1103
msgid "Not Installed"
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1105
msgid "Installed But Not Activated"
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1275
#, php-format
msgid ""
"No plugins to install or activate. <a href=\"%1$s\" title=\"Return to the "
"Dashboard\">Return to the Dashboard</a>"
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1291
msgid "Plugin"
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1292
msgid "Source"
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1293
msgid "Type"
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1294
msgid "Status"
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1312
msgid "Install"
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1313
msgid "Activate"
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1823
msgid "Install package not available."
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1824
#, php-format
msgid "Downloading install package from <span class=\"code\">%s</span>&#8230;"
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1825
msgid "Unpacking the package&#8230;"
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1826
msgid "Installing the plugin&#8230;"
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1827
msgid "Plugin install failed."
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1828
msgid "Plugin installed successfully."
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1839
msgid "Plugin activation failed."
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1949
msgid ""
"The installation and activation process is starting. This process may take a "
"while on some hosts, so please be patient."
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1950
#, php-format
msgid "%1$s installed and activated successfully."
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1950
#: ../lib/classes/class-tgm-plugin-activation.php:1959
msgid "Show Details"
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1950
#: ../lib/classes/class-tgm-plugin-activation.php:1959
msgid "Hide Details"
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1951
msgid "All installations and activations have been completed."
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1952
#, php-format
msgid "Installing and Activating Plugin %1$s (%2$d/%3$d)"
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1956
msgid ""
"The installation process is starting. This process may take a while on some "
"hosts, so please be patient."
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1957
#, php-format
msgid "An error occurred while installing %1$s: <strong>%2$s</strong>."
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1958
#, php-format
msgid "The installation of %1$s failed."
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1959
#, php-format
msgid "%1$s installed successfully."
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1960
msgid "All installations have been completed."
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:1961
#, php-format
msgid "Installing Plugin %1$s (%2$d/%3$d)"
msgstr ""
#: ../lib/classes/class-tgm-plugin-activation.php:2052
msgid "Return to the Dashboard"
msgstr ""
#: ../lib/functions/theme-functions.php:136
msgid "Trestle Auto Nav Placeholder"
msgstr ""
+422
View File
@@ -0,0 +1,422 @@
<?php
/**
* Trestle admin functions
*
* @since 1.0.0
*
* @package Trestle
*/
/**
* Loads admin scripts and styles.
*
* @since 1.0.0
*/
function trestle_admin_actions() {
// Add admin jQuery
wp_enqueue_script( 'trestle-admin-jquery', get_stylesheet_directory_uri() . '/lib/admin/admin.js', array( 'jquery' ), '1.0.0', true );
// Add admin jQuery
wp_enqueue_style( 'trestle-admin', get_stylesheet_directory_uri() . '/lib/admin/admin.css' );
// Add admin CSS
add_editor_style( get_stylesheet_directory_uri() . '/lib/admin/editor-style.css' );
}
/**
* Sets up Trestle default settings.
*
* @since 1.0.0
*
* @param array $defaults Genesis default settings.
* @return array Genesis settings updated to include Trestle defaults.
*/
function trestle_custom_defaults( $defaults ) {
// Trestle default key/value pairs
$trestle_defaults = array(
'trestle_layout' => 'solid',
'trestle_auto_nav' => 0,
'trestle_include_home_link' => 0,
'trestle_nav_button_text' => '[icon name="icon-list-ul"] ' . __( 'Navigation', 'trestle' ),
'trestle_read_more_text' => __( 'Read&nbsp;More&nbsp;&raquo;', 'trestle' ),
'trestle_revisions_number' => 3,
);
// Populate Trestle settings with default values if they don't yet exist
$options = get_option( GENESIS_SETTINGS_FIELD );
foreach ( $trestle_defaults as $k => $v ) {
// Add defaults to Genesis default settings array
$defaults[$k] = $v;
// Update actual options if they don't yet exist
if ( $options && ! array_key_exists( $k, $options ) )
$options[$k] = $v;
}
// Update options with defaults
update_option( GENESIS_SETTINGS_FIELD, $options );
return $defaults;
}
/**
* Adds sanitization for various Trestle admin settings.
*
* @since 1.0.0
*/
function trestle_register_social_sanitization_filters() {
// 1 or 0
genesis_add_option_filter(
'one_zero',
GENESIS_SETTINGS_FIELD,
array(
'trestle_auto_nav',
'trestle_include_home_link',
'trestle_link_icons',
)
);
// Integer
genesis_add_option_filter(
'int',
GENESIS_SETTINGS_FIELD,
array(
'footer-widgets-number',
'trestle_revisions_number',
)
);
// No HTML
genesis_add_option_filter(
'no_html',
GENESIS_SETTINGS_FIELD,
array(
'trestle_layout',
)
);
// Safe HTML
genesis_add_option_filter(
'safe_html',
GENESIS_SETTINGS_FIELD,
array(
'trestle_nav_button_text',
'trestle_read_more_text'
)
);
}
/**
* Registers Trestle admin settings box.
*
* @since 1.0.0
*
* @global array $_genesis_admin_settings Genesis admin settings.
*
* @param string $_genesis_theme_settings_pagehook Hook for main Genesis settings page in admin.
*/
function trestle_register_settings_box( $_genesis_theme_settings_pagehook ) {
global $_genesis_admin_settings;
// Create Trestle settings metabox
$settings_box_title = __( 'Trestle Settings <small>by</small>', 'trestle' ) . ' <a href="http://mightyminnow.com" target="_blank">MIGHTYminnow</a>';
add_meta_box( 'trestle-settings', $settings_box_title, 'trestle_settings_box', $_genesis_theme_settings_pagehook, 'main', 'high' );
}
/**
* Outputs contents of Trestle admin settings box on Genesis settings page.
*
* @since 1.0.0
*/
function trestle_settings_box() {
// Set path for image radio inputs
$img_path = get_stylesheet_directory_uri() . '/images/admin/';
?>
<h4><?php _e( 'Layout', 'trestle' ) ?></h4>
<p class="trestle-layout">
<img src="<?php echo $img_path; ?>icon-solid.gif" width="200" height="160" <?php echo 'solid' == genesis_get_option( 'trestle_layout' ) ? 'class="checked"' : '' ?> />
<input type="radio" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_layout]" value="solid" <?php checked( esc_attr( genesis_get_option( 'trestle_layout' ) ), 'solid' ); ?> />
<img src="<?php echo $img_path; ?>icon-bubble.gif" width="200" height="160" <?php echo 'bubble' == genesis_get_option( 'trestle_layout' ) ? 'class="checked"' : '' ?> />
<input type="radio" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_layout]" value="bubble" <?php checked( esc_attr( genesis_get_option( 'trestle_layout' ) ), 'bubble' ); ?> />
</p>
<h4><?php _e( 'Primary Navigation', 'trestle' ) ?></h4>
<p>
<input type="checkbox" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_auto_nav]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_auto_nav]" value="1" <?php checked( esc_attr( genesis_get_option( 'trestle_auto_nav' ) ), 1); ?> /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_auto_nav]"><?php _e( 'Automatically generate nav menu (replaces custom/manual menu with auto-generated menu)', 'trestle' ); ?></label><br />
<input type="checkbox" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_include_home_link]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_include_home_link]" value="1" <?php checked( esc_attr( genesis_get_option( 'trestle_include_home_link' ) ), 1); ?> /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_include_home_link]"><?php _e( 'Include home link', 'trestle' ); ?></label>
</p>
<p>
<?php _e( 'Text for mobile navigation button (shortcodes can be included):', 'trestle' ); ?></label><br />
<input class="widefat" type="text" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_nav_button_text]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_nav_button_text]" value="<?php echo esc_attr( genesis_get_option( 'trestle_nav_button_text' ) ); ?>" /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_nav_button_text]">
</p>
<h4><?php _e( 'Primary Navigation Extras', 'trestle' ) ?></h4>
<p><input type="checkbox" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_custom_nav_extras]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_custom_nav_extras]" value="1" <?php checked( esc_attr( genesis_get_option( 'trestle_custom_nav_extras' ) ), 1); ?> /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_custom_nav_extras]"><?php _e( 'Display custom navigation extras content (overrides standard Genesis navigation extras)', 'trestle' ); ?></label></p>
<p>
<?php _e( 'Custom navigation extras text:', 'trestle' ); ?><br />
<input class="widefat" type="text" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_custom_nav_extras_text]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_custom_nav_extras_text]" value="<?php echo esc_attr( genesis_get_option( 'trestle_custom_nav_extras_text' ) ); ?>" /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_custom_nav_extras_text]">
</p>
<h4><?php _e( 'Blog/Posts', 'trestle' ) ?></h4>
<p>
<label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_read_more_text]"><?php _e( 'Custom read more link text', 'trestle' ); ?></label>: <input type="text" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_read_more_text]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_read_more_text]" value="<?php echo esc_attr( genesis_get_option( 'trestle_read_more_text' ) ); ?>" /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_read_more_text]">
</p>
<p>
<label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_revisions_number]"><?php _e( 'Number of post revisions', 'trestle' ) ?>: </label>
<select name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_revisions_number]" />
<option value="-1" <?php selected( esc_attr( genesis_get_option( 'trestle_revisions_number' ) ), '-1' ); ?> >Unlimited</option>
<?php
for( $i=0; $i<=10; $i++ ) {
echo '<option value="' . $i . '" ' . selected( esc_attr( genesis_get_option( 'trestle_revisions_number' ) ), $i, false ) . '>' . $i . '</option>' . "\n";
}
?>
</select>
</p>
<h4><?php _e( 'Post Info & Meta', 'trestle' ) ?></h4>
<p><input type="checkbox" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_manual_post_info_meta]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_manual_post_info_meta]" value="1" <?php checked( esc_attr( genesis_get_option( 'trestle_manual_post_info_meta' ) ), 1); ?> /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_manual_post_info_meta]"><?php _e( 'Manually select where to show Post Info & Meta', 'trestle' ); ?></label></p>
<div class="trestle-post-info-meta">
<div class="one-half first">
<b><?php _e( 'Show Post Info on:', 'trestle' ) ?></b>
<?php
$post_types = get_post_types();
foreach ( $post_types as $post_type ) {
$post_type_object = get_post_type_object( $post_type );
$name = $post_type_object->labels->name;
$slug = $post_type_object->name;
?>
<hr />
<input type="checkbox" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_post_info_<?php echo $slug ?>_single]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_post_info_<?php echo $slug ?>_single]" value="1" <?php checked( esc_attr( genesis_get_option( 'trestle_post_info_' . $slug . '_single' ) ), 1); ?> />
<label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_post_info_<?php echo $slug ?>_single]"><?php printf( __( '%s (single)', 'trestle' ), $name ); ?></label><br />
<input type="checkbox" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_post_info_<?php echo $slug ?>_archive]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_post_info_<?php echo $slug ?>_archive]" value="1" <?php checked( esc_attr( genesis_get_option( 'trestle_post_info_' . $slug . '_archive' ) ), 1); ?> />
<label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_post_info_<?php echo $slug ?>_archive]"><?php printf( __( '%s (archive)', 'trestle' ), $name ); ?></label>
<?php
}
?>
<br /><br />
</div>
<div class="one-half">
<b><?php _e( 'Show Post Meta on:', 'trestle' ) ?></b>
<?php
$post_types = get_post_types();
foreach ( $post_types as $post_type ) {
$post_type_object = get_post_type_object( $post_type );
$name = $post_type_object->labels->name;
$slug = $post_type_object->name;
?>
<hr />
<input type="checkbox" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_post_meta_<?php echo $slug ?>_single]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_post_meta_<?php echo $slug ?>_single]" value="1" <?php checked( esc_attr( genesis_get_option( 'trestle_post_meta_' . $slug . '_single' ) ), 1); ?> />
<label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_post_meta_<?php echo $slug ?>_single]"><?php printf( __( '%s (single)', 'trestle' ), $name ); ?></label><br />
<input type="checkbox" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_post_meta_<?php echo $slug ?>_archive]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_post_meta_<?php echo $slug ?>_archive]" value="1" <?php checked( esc_attr( genesis_get_option( 'trestle_post_meta_' . $slug . '_archive' ) ), 1); ?> />
<label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_post_meta_<?php echo $slug ?>_archive]"><?php printf( __( '%s (archive)', 'trestle' ), $name ); ?></label>
<?php
}
?>
<br /><br />
</div>
</div>
<h4><?php _e( 'Footer Widgets', 'trestle' ) ?></h4>
<p class="trestle-layout">
<label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_footer_widgets_number]"><?php _e( 'Number', 'trestle' ); ?>: </label>
<select name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_footer_widgets_number]" />
<?php
for( $i=0; $i<=6; $i++ ) {
echo '<option value="' . $i . '" ' . selected( esc_attr( genesis_get_option( 'trestle_footer_widgets_number' ) ), $i, false ) . '>' . $i . '</option>' . "\n";
}
?>
</select>
</p>
<h4><?php _e( 'Link Icons', 'trestle' ) ?></h4>
<p>
<input type="checkbox" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_external_link_icons]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_external_link_icons]" value="1" <?php checked( esc_attr( genesis_get_option( 'trestle_external_link_icons' ) ), 1); ?> /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_external_link_icons]"><?php _e( 'Add icons to external links', 'trestle' ); ?></label><br />
<input type="checkbox" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_email_link_icons]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_email_link_icons]" value="1" <?php checked( esc_attr( genesis_get_option( 'trestle_email_link_icons' ) ), 1); ?> /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_email_link_icons]"><?php _e( 'Add icons to email links', 'trestle' ); ?></label><br />
<input type="checkbox" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_pdf_link_icons]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_pdf_link_icons]" value="1" <?php checked( esc_attr( genesis_get_option( 'trestle_pdf_link_icons' ) ), 1); ?> /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_pdf_link_icons]"><?php _e( 'Add icons to .pdf links', 'trestle' ); ?></label><br />
<input type="checkbox" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_document_link_icons]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_doc_link_icons]" value="1" <?php checked( esc_attr( genesis_get_option( 'trestle_doc_link_icons' ) ), 1); ?> /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_document_link_icons]"><?php _e( 'Add icons to .doc links', 'trestle' ); ?></label>
</p>
<?php
}
/**
* Loads required & recommended plugins.
*
* Utilizes TGM Plugin Activation class:
* https://github.com/thomasgriffin/TGM-Plugin-Activation
*
* @since 1.0.0
*
* @see tgmpa() in /lib/classes/class-tgm-plugin-activation.php
*/
function trestle_register_required_plugins() {
$plugins = array(
// Required plugins
array(
'name' => 'Font Awesome Icons',
'slug' => 'font-awesome',
'required' => true,
),
// Optional plugins
array(
'name' => 'Black Studio TinyMCE Widget',
'slug' => 'black-studio-tinymce-widget',
'required' => false,
),
array(
'name' => 'Events Manager',
'slug' => 'events-manager',
'required' => false,
),
array(
'name' => 'Exclude Pages',
'slug' => 'exclude-pages',
'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',
'required' => false,
),
array(
'name' => 'Google Analytics for WordPress',
'slug' => 'google-analytics-for-wordpress',
'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',
'required' => false,
),
array(
'name' => 'Post Types Order',
'slug' => 'post-types-order',
'required' => false,
),
array(
'name' => 'Social Media Widget',
'slug' => 'social-media-widget',
'required' => false,
),
array(
'name' => 'Widget Context',
'slug' => 'widget-context',
'required' => false,
),
array(
'name' => 'Respond.js',
'slug' => 'respondjs',
'required' => false,
),
array(
'name' => 'Simple Image Sizes',
'slug' => 'simple-image-sizes',
'required' => false,
),
array(
'name' => 'Simple Section Navigation',
'slug' => 'simple-section-navigation',
'required' => false,
),
array(
'name' => 'Types - Custom Fields and Custom Post Types Management',
'slug' => 'types',
'required' => false,
),
array(
'name' => 'WordPress Hotkeys',
'slug' => 'wordpress-hotkeys',
'required' => false,
),
);
// Change this to your theme text domain, used for internationalising strings
$theme_text_domain = 'mightyminnow';
/**
* Array of configuration settings. Amend each line as needed.
* If you want the default strings to be available under your own theme domain,
* leave the strings uncommented.
* Some of the strings are added into a sprintf, so see the comments at the
* end of each line for what each argument will be.
*/
$config = array(
'domain' => $theme_text_domain, // Text domain - likely want to be the same as your theme.
'default_path' => '', // Default absolute path to pre-packaged plugins
'parent_menu_slug' => 'themes.php', // Default parent menu slug
'parent_url_slug' => 'themes.php', // Default parent URL slug
'menu' => 'install-required-plugins', // Menu slug
'has_notices' => true, // Show admin notices or not
'is_automatic' => true, // Automatically activate plugins after installation or not
'message' => '', // Message to output right before the plugins table
'strings' => array(
'page_title' => __( 'Install Required Plugins', $theme_text_domain ),
'menu_title' => __( 'Install Plugins', $theme_text_domain ),
'installing' => __( 'Installing Plugin: %s', $theme_text_domain ), // %1$s = plugin name
'oops' => __( 'Something went wrong with the plugin API.', $theme_text_domain ),
'notice_can_install_required' => _n_noop( 'This theme requires the following plugin: %1$s.', 'This theme requires the following plugins: %1$s.' ), // %1$s = plugin name(s)
'notice_can_install_recommended' => _n_noop( 'Recommended plugin: %1$s.', 'Recommended plugins: %1$s.' ), // %1$s = plugin name(s)
'notice_cannot_install' => _n_noop( 'Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'Sorry, but you do not have the correct permissions to install the %s plugins. Contact the administrator of this site for help on getting the plugins installed.' ), // %1$s = plugin name(s)
'notice_can_activate_required' => _n_noop( 'The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.' ), // %1$s = plugin name(s)
'notice_can_activate_recommended' => _n_noop( 'The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.' ), // %1$s = plugin name(s)
'notice_cannot_activate' => _n_noop( 'Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'Sorry, but you do not have the correct permissions to activate the %s plugins. Contact the administrator of this site for help on getting the plugins activated.' ), // %1$s = plugin name(s)
'notice_ask_to_update' => _n_noop( 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.' ), // %1$s = plugin name(s)
'notice_cannot_update' => _n_noop( 'Sorry, but you do not have the correct permissions to update the %s plugin. Contact the administrator of this site for help on getting the plugin updated.', 'Sorry, but you do not have the correct permissions to update the %s plugins. Contact the administrator of this site for help on getting the plugins updated.' ), // %1$s = plugin name(s)
'install_link' => _n_noop( 'Begin installing plugin', 'Begin installing plugins' ),
'activate_link' => _n_noop( 'Activate installed plugin', 'Activate installed plugins' ),
'return' => __( 'Return to Required Plugins Installer', $theme_text_domain ),
'plugin_activated' => __( 'Plugin activated successfully.', $theme_text_domain ),
'complete' => __( 'All plugins installed and activated successfully. %s', $theme_text_domain ), // %1$s = dashboard link
'nag_type' => 'updated' // Determines admin notice type - can only be 'updated' or 'error'
)
);
tgmpa( $plugins, $config );
}
+122
View File
@@ -0,0 +1,122 @@
/*
* Trestle admin styles
*
* @since 1.0.0
*
* @package Trestle
*/
.trestle-layout img {
margin-right: 10px;
border: 4px solid transparent;
cursor: pointer;
}
.trestle-layout img:hover {
border-color: #EEE;
}
.trestle-layout img.checked {
border-color: #CCC;
}
/* Columns
--------------------------------------------- */
.five-sixths,
.four-sixths,
.one-fourth,
.one-half,
.one-sixth,
.one-third,
.three-fourths,
.three-sixths,
.two-fourths,
.two-sixths,
.two-thirds,
.footer-widgets .widget-area {
float: left;
margin: 0;
width: 100%;
}
/* Media Queries
--------------------------------------------- */
@media (min-width: 768px) {
/* Columns
--------------------------------------------- */
.five-sixths,
.four-sixths,
.one-fourth,
.one-half,
.one-sixth,
.one-third,
.three-fourths,
.three-sixths,
.two-fourths,
.two-sixths,
.two-thirds,
.footer-widgets .widget-area {
margin-left: 2.564102564102564%;
}
.one-half,
.three-sixths,
.two-fourths,
.footer-widgets-number-2 .footer-widgets .widget-area {
width: 48.717948717948715%;
}
.one-third,
.two-sixths,
.sidebar-primary,
.title-area,
.footer-widgets-number-3 .footer-widgets .widget-area {
width: 31.623931623931625%;
}
.four-sixths,
.two-thirds,
.content {
width: 65.81196581196582%;
}
.one-fourth,
.footer-widgets-number-4 .footer-widgets .widget-area {
width: 23.076923076923077%;
}
.three-fourths {
width: 74.35897435897436%;
}
.one-fifth,
.footer-widgets-number-5 .footer-widgets .widget-area {
width: 17.948717949%;
}
.one-sixth,
.footer-widgets-number-6 .footer-widgets .widget-area {
width: 14.52991452991453%;
}
.five-sixths {
width: 82.90598290598291%;
}
.first,
.footer-widgets .footer-widgets-1 {
clear: both;
margin-left: 0;
}
/* Lists inside columns (to remove bottom margin as needed at mobile sizes */
.no-list-margin ul,
.no-list-margin ol {
margin-bottom: 26px;
margin-bottom: 2.6rem;
}
}
+31
View File
@@ -0,0 +1,31 @@
/**
* jQuery that runs in the WordPress admin
*
* @since 1.0.0
*
* @package Trestle
*/
// Executes when the document is ready
jQuery(document).ready(function() {
// Hide Trestle layout radio buttons
jQuery('.trestle-layout img').next('input[type="radio"]').hide();
// Add radio button functionality to layout icons
jQuery('.trestle-layout img').click(function() {
jQuery(this).next('input[type="radio"]').attr('checked', true);
jQuery('.trestle-layout img').removeClass('checked');
jQuery(this).addClass('checked');
});
// Add drop-down functionality for Post Info & Meta options
if( ! jQuery('#genesis-settings\\[trestle_manual_post_info_meta\\]').is(':checked') ) {
jQuery('.trestle-post-info-meta').hide();
}
jQuery('#genesis-settings\\[trestle_manual_post_info_meta\\]').change(function() {
jQuery('.trestle-post-info-meta').slideToggle();
});
}); /* end of as page load scripts */
+17 -123
View File
@@ -1,132 +1,26 @@
<?php
/*===========================================
* Trestle Custom Theme Settings
/**
* Trestle admin functionality
*
* Modified from: http://www.billerickson.net/genesis-theme-options/
===========================================*/
/*===========================================
* Admin styles and scripts
===========================================*/
// Add admin scripts and styles
function trestle_admin_actions() {
// Add admin jQuery
wp_enqueue_script( 'trestle-admin-jquery', get_stylesheet_directory_uri() . '/lib/admin/admin.js', array( 'jquery' ), '1.0', true );
// Add admin jQuery
wp_enqueue_style( 'trestle-admin', get_stylesheet_directory_uri() . '/lib/admin/admin.css' );
// Add admin CSS (doesn't exist at present)
add_editor_style( get_stylesheet_directory_uri() . '/lib/admin/editor.css' );
}
/**
* Do Trestle default settings
*
* @param array $defaults default Genesis settings
* @return array modified Genesis defaults array
* @since 1.0.0
*
* @package Trestle
*/
function trestle_custom_defaults( $defaults ) {
// Trestle default key/value pairs
$trestle_defaults = array(
'trestle_layout' => 'solid',
'trestle_auto_nav' => 0,
'trestle_include_home_link' => 0,
'trestle_nav_button_text' => __( '[icon name="icon-list-ul"] Navigation', 'trestle' ),
'trestle_link_icons' => 0,
);
// Populate Trestle settings with default values if they don't yet exist
$options = get_option( GENESIS_SETTINGS_FIELD );
foreach ( $trestle_defaults as $k => $v ) {
// Require admin functions
require_once dirname( __FILE__ ) . '/admin-functions.php';
// Add defaults to Genesis default settings array
$defaults[$k] = $v;
// Trestle admin scripts and styles
add_action( 'admin_enqueue_scripts', 'trestle_admin_actions' );
// Update actual options if they don't yet exist
if ( $options && !array_key_exists( $k, $options ) )
$options[$k] = $v;
// Trestle default settings
add_filter( 'genesis_theme_settings_defaults', 'trestle_custom_defaults' );
}
update_option( GENESIS_SETTINGS_FIELD, $options );
// Return modified default array
return $defaults;
}
/**
* Add sanitization functionality to Trestle options
*/
function trestle_register_social_sanitization_filters() {
// No HTML
genesis_add_option_filter(
'no_html',
GENESIS_SETTINGS_FIELD,
array(
'trestle_auto_nav',
'trestle_include_home_link',
)
);
// Safe HTML
genesis_add_option_filter(
'safe_html',
GENESIS_SETTINGS_FIELD,
array(
'trestle_nav_button_text',
)
);
}
// Sanitize settings
add_action( 'genesis_settings_sanitizer_init', 'trestle_register_social_sanitization_filters' );
/**
* Register Trestle metabox
*/
function trestle_register_settings_box( $_genesis_theme_settings_pagehook ) {
// Register Trestle settings metabox
add_action( 'genesis_theme_settings_metaboxes', 'trestle_register_settings_box' );
global $_genesis_admin_settings;
// Create Trestle settings metabox
add_meta_box( 'trestle-settings', __( 'Trestle Settings', 'trestle' ), 'trestle_settings_box', $_genesis_theme_settings_pagehook, 'main', 'high' );
}
/**
* Output Trestle metabox
*/
function trestle_settings_box() {
$img_path = get_stylesheet_directory_uri() . '/images/admin/';
?>
<h4><?php _e( 'Layout', 'trestle' ) ?></h4>
<p class="trestle-layout">
<img src="<?php echo $img_path; ?>icon-solid.gif" width="200" height="150" <?php echo 'solid' == genesis_get_option('trestle_layout') ? 'class="checked"' : '' ?> />
<input type="radio" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_layout]" value="solid" <?php checked( esc_attr( genesis_get_option('trestle_layout') ), 'solid' ); ?> />
<img src="<?php echo $img_path; ?>icon-bubble.gif" width="200" height="150" <?php echo 'bubble' == genesis_get_option('trestle_layout') ? 'class="checked"' : '' ?> />
<input type="radio" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_layout]" value="bubble" <?php checked( esc_attr( genesis_get_option('trestle_layout') ), 'bubble' ); ?> />
</p>
<h4><?php _e( 'Primary Navigation Options', 'trestle' ) ?></h4>
<p>
<input type="checkbox" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_auto_nav]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_auto_nav]" value="1" <?php checked( esc_attr( genesis_get_option('trestle_auto_nav') ), 1); ?> /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_auto_nav]"><?php _e( 'Automatically generate nav menu (replaces custom/manual menu with auto-generated menu)', 'trestle' ); ?></label><br />
<input type="checkbox" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_include_home_link]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_include_home_link]" value="1" <?php checked( esc_attr( genesis_get_option('trestle_include_home_link') ), 1); ?> /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_include_home_link]"><?php _e( 'Include Home Link', 'trestle' ); ?></label>
</p>
<p>
<?php _e('Text for mobile navigation button (shortcodes can be included):', 'trestle' ); ?></label><br />
<input class="widefat" type="text" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_nav_button_text]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_nav_button_text]" value="<?php echo esc_attr( genesis_get_option('trestle_nav_button_text') ); ?>" /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_nav_button_text]">
</p>
<h4><?php _e( 'Additional Settings', 'trestle' ) ?></h4>
<p>
<input type="checkbox" id="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_link_icons]" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_link_icons]" value="1" <?php checked( esc_attr( genesis_get_option('trestle_link_icons') ), 1); ?> /> <label for="<?php echo GENESIS_SETTINGS_FIELD; ?>[trestle_link_icons]"><?php _e( 'Automatically add icons to external, email, pdf, and document links.', 'trestle' ); ?></label><br />
</p>
<?php
}
// Required & recommended plugins
add_action( 'tgmpa_register', 'trestle_register_required_plugins' );
+17
View File
@@ -0,0 +1,17 @@
/*
* Trestle editor styles
*
* @since 1.0.0
*
* @package Trestle
*/
@import url( '/wp-content/themes/trestle/style.css' );
/* Overrides
--------------------------------------------- */
.content {
width: 100%;
font-size: 1.6rem;
}
+310
View File
@@ -0,0 +1,310 @@
<?php
/**
* Trestle theme functions (front-end)
*
* Note: all admin theme functionality is located at: trestle/lib/admin/admin.php
*
* @since 1.0.0
*
* @package Trestle
*/
/*===========================================
* Header Styles & Scripts
===========================================*/
/**
* Loads theme scripts and styles.
*
* @since 1.0.0
*/
function trestle_header_actions() {
// Google fonts
wp_enqueue_style( 'trestle-google-fonts', '//fonts.googleapis.com/css?family=Lato:300,700,900' );
// Custom jQuery
wp_enqueue_script( 'trestle-jquery', get_stylesheet_directory_uri() . '/lib/js/theme-jquery.js', array( 'jquery' ), '1.0.0', true );
}
/*===========================================
* Auto & Mobile Navigation
===========================================*/
/**
* 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() {
// Add mobile nav button
add_action( 'genesis_after_header', 'trestle_add_mobile_nav', 0 );
// 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();
}
/**
* Adds button to open primary mobile navigation menu.
*
* @since 1.0.0
*/
function trestle_add_mobile_nav() {
// Only add the button if there is a primary menu
if ( 1 == genesis_get_option( 'trestle_auto_nav' ) || has_nav_menu( 'primary' ) )
echo '<a id="menu-button" class="button" href="javascript: void(0)">' . do_shortcode( genesis_get_option( 'trestle_nav_button_text' ) ) . '</a>';
}
/**
* Auto-generates list of pages for use in the primary navigation menu.
*
* @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(
'echo' => false,
'show_home' => 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.
* @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>';
}
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() {
// Set title for Trestle placeholder navigation menu
$trestle_nav_title = __( 'Trestle Auto Nav Placeholder', 'trestle' );
// 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 ) && ! has_nav_menu( 'primary' ) ) {
// Create placholder menu
wp_create_nav_menu( $trestle_nav_title );
// Assign placeholder menu to '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
===========================================*/
/**
* Sets the number of post revisions.
*
* @since 1.0.0
*
* @param int $num Default number of post revisions.
* @return int Number of post revisions specified in Trestle admin panel.
*/
function trestle_update_revisions_number( $num ) {
$trestle_revisions_number = esc_attr( genesis_get_option( 'trestle_revisions_number' ) );
if ( isset( $trestle_revisions_number ) )
return $trestle_revisions_number;
return $num;
}
/**
* 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( in_the_loop() && genesis_get_option( 'trestle_manual_post_info_meta' ) ) {
global $post;
// Get post type
$orig_post_type = '';
$post_type = get_post_type( $post->ID );
// Override "page" post type to allow for Post Info & Meta (reset back to page below)
if ( 'page' == $post_type ) {
$orig_post_type = 'page';
set_post_type( $post->ID, 'post' );
}
// 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' );
}
// Reset post type back to page if need be
if ( ! empty( $orig_post_type ) && 'page' == $orig_post_type )
add_action( 'genesis_entry_footer', 'trestle_set_page_post_type' );
}
}
/*===========================================
* General Actions & Filters
===========================================*/
/**
* Adds custom classes to the <body> element for styling purposes.
*
* @since 1.0.0
*
* @param array $classes Body classes.
* @return array Updated body classes.
*/
function trestle_body_classes( $classes ) {
// Add 'no-jquery' class to be removed by jQuery if enabled
$classes[] = 'no-jquery';
// Add 'bubble' class
if ( 'bubble' == genesis_get_option( 'trestle_layout' ) )
$classes[] = 'bubble';
// Add link icon classes
if ( genesis_get_option( 'trestle_external_link_icons' ) )
$classes[] = 'external-link-icons';
if ( genesis_get_option( 'trestle_email_link_icons' ) )
$classes[] = 'email-link-icons';
if ( genesis_get_option( 'trestle_pdf_link_icons' ) )
$classes[] = 'pdf-link-icons';
if ( genesis_get_option( 'trestle_doc_link_icons' ) )
$classes[] = 'doc-link-icons';
// 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' ) );
return $classes;
}
/**
* Resets post type back to page once post info / meta functionality is done.
*
* @since 1.0.0
*
* @global object $post The current $post object.
*/
function trestle_set_page_post_type() {
global $post;
set_post_type( $post->ID, 'page' );
}
/**
* Displays custom Trestle "read more" text in place of WordPress default.
*
* @since 1.0.0
*
* @param string $default_text Default "read more" text.
* @return string (Updated) "read more" text.
*/
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' ) );
if ( $custom_text )
return '&hellip;&nbsp;<a class="more-link" href="' . get_permalink() . '">' . $custom_text . '</a>';
else
return $default_text;
}
-321
View File
@@ -1,321 +0,0 @@
<?php
/**
* Trestle Theme Functions
* @since 1.0
*/
/*===========================================
* Header styles and scripts
===========================================*/
function trestle_header_actions() {
// Google fonts
wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Lato:300,700,900' );
// Custom jQuery
wp_enqueue_script( 'trestle-jquery', get_stylesheet_directory_uri() . '/lib/js/jquery.js', array( 'jquery' ), '1.0', true );
}
/*===========================================
* Load Required/Suggested Plugins
*
* Utilizes TGM Plugin Activation class:
* https://github.com/thomasgriffin/TGM-Plugin-Activation
===========================================*/
// Fetch & install plugins from wordpress.org
function trestle_register_required_plugins() {
$plugins = array(
// Required plugins
array(
'name' => 'Font Awesome Icons',
'slug' => 'font-awesome',
'required' => true,
),
// Optional plugins
array(
'name' => 'Black Studio TinyMCE Widget',
'slug' => 'black-studio-tinymce-widget',
'required' => true,
),
array(
'name' => 'Events Manager',
'slug' => 'events-manager',
'required' => true,
),
array(
'name' => 'Exclude Pages',
'slug' => 'exclude-pages',
'required' => true,
),
array(
'name' => 'FancyBox for WordPress',
'slug' => 'fancybox-for-wordpress',
'required' => true,
),
array(
'name' => 'Genesis Featured Widget Amplified',
'slug' => 'genesis-featured-widget-amplified',
'required' => true,
),
array(
'name' => 'Genesis Simple Edits',
'slug' => 'genesis-simple-edits',
'required' => true,
),
array(
'name' => 'MapPress Easy Google Maps',
'slug' => 'mappress-google-maps-for-wordpress',
'required' => true,
),
array(
'name' => 'My Page Order',
'slug' => 'my-page-order',
'required' => true,
),
array(
'name' => 'NextGen Gallery',
'slug' => 'nextgen-gallery',
'required' => true,
),
array(
'name' => 'Post Thumbnail Editor',
'slug' => 'post-thumbnail-editor',
'required' => true,
),
array(
'name' => 'Social Media Widget',
'slug' => 'social-media-widget',
'required' => true,
),
array(
'name' => 'Widget Context',
'slug' => 'widget-context',
'required' => true,
),
array(
'name' => 'Respond.js',
'slug' => 'respondjs',
'required' => true,
),
array(
'name' => 'Simple Image Sizes',
'slug' => 'simple-image-sizes',
'required' => true,
),
array(
'name' => 'Simple Section Navigation',
'slug' => 'simple-section-navigation',
'required' => true,
),
array(
'name' => 'Types - Custom Fields and Custom Post Types Management',
'slug' => 'types',
'required' => true,
),
);
// Change this to your theme text domain, used for internationalising strings
$theme_text_domain = 'mightyminnow';
/**
* Array of configuration settings. Amend each line as needed.
* If you want the default strings to be available under your own theme domain,
* leave the strings uncommented.
* Some of the strings are added into a sprintf, so see the comments at the
* end of each line for what each argument will be.
*/
$config = array(
'domain' => $theme_text_domain, // Text domain - likely want to be the same as your theme.
'default_path' => '', // Default absolute path to pre-packaged plugins
'parent_menu_slug' => 'themes.php', // Default parent menu slug
'parent_url_slug' => 'themes.php', // Default parent URL slug
'menu' => 'install-required-plugins', // Menu slug
'has_notices' => true, // Show admin notices or not
'is_automatic' => true, // Automatically activate plugins after installation or not
'message' => '', // Message to output right before the plugins table
'strings' => array(
'page_title' => __( 'Install Required Plugins', $theme_text_domain ),
'menu_title' => __( 'Install Plugins', $theme_text_domain ),
'installing' => __( 'Installing Plugin: %s', $theme_text_domain ), // %1$s = plugin name
'oops' => __( 'Something went wrong with the plugin API.', $theme_text_domain ),
'notice_can_install_required' => _n_noop( 'This theme requires the following plugin: %1$s.', 'This theme requires the following plugins: %1$s.' ), // %1$s = plugin name(s)
'notice_can_install_recommended' => _n_noop( 'This theme recommends the following plugin: %1$s.', 'This theme recommends the following plugins: %1$s.' ), // %1$s = plugin name(s)
'notice_cannot_install' => _n_noop( 'Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'Sorry, but you do not have the correct permissions to install the %s plugins. Contact the administrator of this site for help on getting the plugins installed.' ), // %1$s = plugin name(s)
'notice_can_activate_required' => _n_noop( 'The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.' ), // %1$s = plugin name(s)
'notice_can_activate_recommended' => _n_noop( 'The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.' ), // %1$s = plugin name(s)
'notice_cannot_activate' => _n_noop( 'Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'Sorry, but you do not have the correct permissions to activate the %s plugins. Contact the administrator of this site for help on getting the plugins activated.' ), // %1$s = plugin name(s)
'notice_ask_to_update' => _n_noop( 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.' ), // %1$s = plugin name(s)
'notice_cannot_update' => _n_noop( 'Sorry, but you do not have the correct permissions to update the %s plugin. Contact the administrator of this site for help on getting the plugin updated.', 'Sorry, but you do not have the correct permissions to update the %s plugins. Contact the administrator of this site for help on getting the plugins updated.' ), // %1$s = plugin name(s)
'install_link' => _n_noop( 'Begin installing plugin', 'Begin installing plugins' ),
'activate_link' => _n_noop( 'Activate installed plugin', 'Activate installed plugins' ),
'return' => __( 'Return to Required Plugins Installer', $theme_text_domain ),
'plugin_activated' => __( 'Plugin activated successfully.', $theme_text_domain ),
'complete' => __( 'All plugins installed and activated successfully. %s', $theme_text_domain ), // %1$s = dashboard link
'nag_type' => 'updated' // Determines admin notice type - can only be 'updated' or 'error'
)
);
tgmpa( $plugins, $config );
}
/*===========================================
* Auto & Mobile Navigation
===========================================*/
function trestle_nav_modifications() {
// Add mobile nav button
add_action( 'genesis_after_header', 'trestle_add_mobile_nav', 0 );
// Auto-generate nav if Genesis theme setting is checked
if ( 1 == genesis_get_option( 'trestle_auto_nav' ) ) {
// Remove existing nav
remove_action( 'genesis_after_header', 'genesis_do_nav' );
// Replace existing nav with auto-generated nav
function trestle_auto_nav() {
$args = array(
'echo' => false,
'show_home' => 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 );
// Add Genesis nav extras
$nav_items = genesis_nav_right( $nav_items, $menu_args );
$nav = '<ul class="' . $ul_class . '">' . $nav_items . '</ul>';
$nav_markup_open = genesis_markup( array(
'html5' => '<nav %s>',
'xhtml' => '<div id="nav">',
'context' => 'nav-primary',
'echo' => false,
) );
$nav_markup_open .= genesis_structural_wrap( 'menu-primary', 'open', 0 );
$nav_markup_close = genesis_structural_wrap( 'menu-primary', 'close', 0 );
$nav_markup_close .= genesis_html5() ? '</nav>' : '</div>';
// Args to pass to navigation right/extras function
$args = new stdClass();
$args->theme_location = 'primary';
echo apply_filters ( 'trestle_do_nav', $nav_markup_open . $nav . $nav_markup_close, $args );
}
add_action( 'genesis_after_header', 'trestle_auto_nav', 0 );
}
}
// Add mobile menu button
function trestle_add_mobile_nav() {
// Only add the button if there is a primary menu
if ( 1 == genesis_get_option( 'trestle_auto_nav' ) || has_nav_menu( 'primary' ) ) {
echo '<a id="menu-button" class="button" href="javascript: void(0)">' . do_shortcode( genesis_get_option('trestle_nav_button_text') ) . '</a>';
}
}
// Generate / remove Trestle Auto Nav placeholder menu as needed (necessary to enable Nav Extras)
function trestle_nav_placeholder() {
$trestle_nav_title = __( 'Trestle Auto Nav Placeholder', 'trestle' );
// 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 ) && !has_nav_menu( 'primary' ) ) {
// Create placholder menu
wp_create_nav_menu( $trestle_nav_title );
// Assign placeholder menu to '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 );
}
/*===========================================
* Actions & Filters
===========================================*/
// Add body classes
function trestle_body_classes( $classes ) {
// Add 'no-jquery' class to be removed by jQuery if enabled
$classes[] = 'no-jquery';
// Add 'bubble' class
if ( 'bubble' == genesis_get_option( 'trestle_layout' ) )
$classes[] = 'bubble';
// Add 'link-icons' class
if ( genesis_get_option('trestle_link_icons') )
$classes[] = 'link-icons';
return $classes;
}
/*===========================================
* Footer
===========================================*/
function trestle_custom_footer($output) {
return $output . '<p class="mm">[footer_childtheme_link before=""] by <a href="http://mightyminnow.com">MIGHTYminnow</a></p>';
}
+60
View File
@@ -0,0 +1,60 @@
/**
* Trestle theme jQuery
*
* @since 1.0.0
*
* @package Trestle
*/
// Executes when the document is ready
jQuery(document).ready(function() {
// Remove .no-jquery body class
jQuery('body').removeClass('no-jquery');
// External Links
var h = window.location.host.toLowerCase();
jQuery('[href^="http://"],[href^="https://"]').not('[href*="' + h + '"]').addClass('external-link').attr("target", "_blank");
// Add classes to different types of links
jQuery('a[href^="mailto:"]').addClass('email-link');
jQuery('a[href*=".pdf"]').attr({"target":"_blank"}).addClass('pdf-link');
jQuery('a[href*=".doc"]').attr({"target":"_blank"}).addClass('doc-link');
jQuery('a').has('img').addClass('image-link');
// Add classes to parts of lists
jQuery('li:last-child').addClass('last');
jQuery('li:first-child').addClass('first');
jQuery('ul, ol').parent('li').addClass('parent');
// Mobile navigation button
jQuery('#menu-button').click(function() {
var button = jQuery(this);
button.toggleClass('open');
jQuery('.menu-primary').slideToggle();
});
// Mobile navigation icons
var closedIcon = '+';
var openIcon = '-';
jQuery('.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="javascript:void()">' + closedIcon + '</a>');
jQuery('.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="javscript: void()">' + openIcon + '</a>');
// Mobile navigation expand/contract functionality
jQuery('.sub-icon').click(function() {
var icon = jQuery(this);
icon.next('ul').slideToggle().toggleClass('open');
if ( icon.text().indexOf( closedIcon ) !== -1 )
icon.text(openIcon);
else if ( icon.text().indexOf( openIcon ) !== -1 )
icon.text(closedIcon);
});
}); /* end of as page load scripts */
// Executes when complete page is fully loaded, including all frames, objects, and images
jQuery(window).load(function() {
});
+43
View File
@@ -0,0 +1,43 @@
<?php
/**
* Trestle shortcodes
*
* @since 1.0.0
*
* @package Trestle
*/
/*===========================================
* Shortcodes
===========================================*/
// Fix for empty <p> tags around shortcodes
function shortcode_empty_paragraph_fix($content)
{
$array = array (
'<p>[' => '[',
']</p>' => ']',
']<br />' => ']'
);
$content = strtr($content, $array);
return $content;
}
add_filter('the_content', 'shortcode_empty_paragraph_fix');
/**
* Columns - [col class="one-half first no-list-margin"]
*
* Classes:
* - width (one-half, one-third, etc - uses native Genesis column classes in style.css)
* - first (used to specify the first column in a row)
* - no-list-margin (will cause contained list elements to collapse as one on mobile sizes)
*/
function column( $atts, $content = null ) {
extract( shortcode_atts( array(
'class' => 'one-half',
), $atts ) );
return '<div class="col ' . $class . '">' . do_shortcode( $content ) . '</div>';
}
add_shortcode( 'col', 'column' );
+237 -1410
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

+351 -220
View File
File diff suppressed because it is too large Load Diff