Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge tag '3.0.0'

Tagging version 3.0.0.
  • Loading branch information...
commit d3a35215a601474d16c6f65ff1ada12b2dbc2217 2 parents 1174197 + 80bd6ee
@justintadlock authored
Showing with 8,576 additions and 8,479 deletions.
  1. +95 −70 admin/admin.php
  2. +146 −0 admin/meta-box-post-layout.php
  3. +99 −0 admin/meta-box-post-style.php
  4. +42 −83 admin/meta-box-post-template.php
  5. +0 −247 admin/theme-settings.php
  6. +111 −0 changelog.md
  7. +0 −89 classes/customize-control-background-image.php
  8. +0 −41 classes/customize-control-textarea.php
  9. +0 −301 classes/hybrid-media-meta.php
  10. +35 −0 contributing.md
  11. +0 −70 css/admin-widgets.css
  12. +0 −1  css/admin-widgets.min.css
  13. +30 −0 css/admin.css
  14. +1 −0  css/admin.min.css
  15. +58 −0 css/customize-controls.css
  16. +1 −0  css/customize-controls.min.css
  17. +179 −63 css/gallery.css
  18. +1 −1  css/gallery.min.css
  19. +337 −0 css/one-five-rtl.css
  20. +1 −0  css/one-five-rtl.min.css
  21. +105 −162 css/one-five.css
  22. +1 −1  css/one-five.min.css
  23. +0 −27 css/reset.css
  24. +0 −1  css/reset.min.css
  25. +90 −0 customize/control-checkbox-multiple.php
  26. +74 −0 customize/control-dropdown-terms.php
  27. +62 −0 customize/control-layout.php
  28. +114 −0 customize/control-palette.php
  29. +100 −0 customize/control-radio-image.php
  30. +116 −0 customize/control-select-group.php
  31. +93 −0 customize/control-select-multiple.php
  32. +61 −0 customize/setting-array-map.php
  33. +65 −0 customize/setting-image-data.php
  34. +1,202 −0 ext/breadcrumb-trail.php
  35. +69 −83 {extensions → ext}/cleaner-gallery.php
  36. +225 −145 {extensions → ext}/get-the-image.php
  37. +0 −1,230 extensions/breadcrumb-trail.php
  38. +0 −92 extensions/cleaner-caption.php
  39. +0 −196 extensions/featured-header.php
  40. +0 −115 extensions/loop-pagination.php
  41. +0 −424 extensions/post-stylesheets.php
  42. +0 −418 extensions/random-custom-background.php
  43. +0 −734 extensions/theme-layouts.php
  44. +0 −177 functions/core.php
  45. +0 −32 functions/customize.php
  46. +0 −150 functions/deprecated.php
  47. +0 −155 functions/head.php
  48. +0 −217 functions/i18n.php
  49. +0 −70 functions/media.php
  50. +0 −52 functions/meta.php
  51. +0 −315 functions/post-formats.php
  52. +0 −69 functions/settings.php
  53. +0 −208 functions/styles.php
  54. +0 −147 functions/template-comments.php
  55. +0 −519 functions/template-general.php
  56. +0 −231 functions/template-media.php
  57. +0 −195 functions/utility.php
  58. +125 −311 hybrid.php
  59. +202 −0 inc/class-chat.php
  60. +118 −0 inc/class-layout-factory.php
  61. +157 −0 inc/class-layout.php
  62. +109 −91 classes/hybrid-media-grabber.php → inc/class-media-grabber.php
  63. +83 −0 inc/class-media-meta-factory.php
  64. +402 −0 inc/class-media-meta.php
  65. +95 −69 functions/attr.php → inc/functions-attr.php
  66. +343 −341 functions/context.php → inc/functions-context.php
  67. +145 −0 inc/functions-customize.php
  68. +239 −0 inc/functions-deprecated.php
  69. +33 −22 functions/filters.php → inc/functions-filters.php
  70. +168 −0 inc/functions-formats.php
  71. +144 −0 inc/functions-head.php
  72. +283 −0 inc/functions-i18n.php
  73. +324 −0 inc/functions-layouts.php
  74. +43 −0 inc/functions-meta.php
  75. +10 −24 functions/scripts.php → inc/functions-scripts.php
  76. +64 −55 functions/sidebars.php → inc/functions-sidebars.php
  77. +245 −0 inc/functions-styles.php
  78. +305 −0 inc/functions-utility.php
  79. +118 −0 inc/template-comments.php
  80. +423 −0 inc/template-general.php
  81. +267 −261 {functions → inc}/template-hierarchy.php
  82. +280 −0 inc/template-media.php
  83. +134 −64 {functions → inc}/template-post.php
  84. +61 −59 {functions → inc}/template.php
  85. +100 −0 js/customize-controls.js
  86. +1 −0  js/customize-controls.min.js
  87. +15 −0 js/customize-preview.js
  88. +1 −0  js/customize-preview.min.js
  89. +5 −5 js/mobile-toggle.js
  90. 0  license.txt → license.md
  91. +21 −46 readme.md
View
165 admin/admin.php
@@ -1,41 +1,28 @@
<?php
/**
- * Theme administration functions used with other components of the framework admin. This file is for
+ * Theme administration functions used with other components of the framework admin. This file is for
* setting up any basic features and holding additional admin helper functions.
*
* @package HybridCore
* @subpackage Admin
* @author Justin Tadlock <justin@justintadlock.com>
- * @copyright Copyright (c) 2008 - 2014, Justin Tadlock
+ * @copyright Copyright (c) 2008 - 2015, Justin Tadlock
* @link http://themehybrid.com/hybrid-core
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
-/* Add the admin setup function to the 'admin_menu' hook. */
-add_action( 'admin_menu', 'hybrid_admin_setup' );
+# Load the post meta boxes on the new post and edit post screens.
+add_action( 'load-post.php', 'hybrid_admin_load_post_meta_boxes' );
+add_action( 'load-post-new.php', 'hybrid_admin_load_post_meta_boxes' );
-/**
- * Sets up the adminstration functionality for the framework and themes.
- *
- * @since 1.3.0
- * @access public
- * @return void
- */
-function hybrid_admin_setup() {
+# Register scripts and styles.
+add_action( 'admin_enqueue_scripts', 'hybrid_admin_register_styles', 0 );
- /* Load the post meta boxes on the new post and edit post screens. */
- add_action( 'load-post.php', 'hybrid_admin_load_post_meta_boxes' );
- add_action( 'load-post-new.php', 'hybrid_admin_load_post_meta_boxes' );
-
- /* Registers admin stylesheets for the framework. */
- add_action( 'admin_enqueue_scripts', 'hybrid_admin_register_styles', 1 );
-
- /* Loads admin stylesheets for the framework. */
- add_action( 'admin_enqueue_scripts', 'hybrid_admin_enqueue_styles' );
-}
+# Allow posts page to be edited.
+add_action( 'edit_form_after_title', 'hybrid_enable_posts_page_editor', 0 );
/**
- * Loads the core post meta box files on the 'load-post.php' action hook. Each meta box file is only loaded if
+ * Loads the core post meta box files on the 'load-post.php' action hook. Each meta box file is only loaded if
* the theme declares support for the feature.
*
* @since 1.2.0
@@ -44,41 +31,47 @@ function hybrid_admin_setup() {
*/
function hybrid_admin_load_post_meta_boxes() {
- /* Load the post template meta box. */
- require_if_theme_supports( 'hybrid-core-template-hierarchy', trailingslashit( HYBRID_ADMIN ) . 'meta-box-post-template.php' );
+ // Load the post template meta box.
+ require_if_theme_supports( 'hybrid-core-template-hierarchy', HYBRID_ADMIN . 'meta-box-post-template.php' );
+
+ // Load the layout meta box.
+ require_if_theme_supports( 'theme-layouts', HYBRID_ADMIN . 'meta-box-post-layout.php' );
+
+ // Load the post style meta box.
+ require_once( HYBRID_ADMIN . 'meta-box-post-style.php' );
}
/**
- * Registers the framework's `admin-widgets.css` stylesheet file. The function does not load the stylesheet.
- * It merely registers it with WordPress.
+ * Registers admin styles.
*
- * @since 1.2.0
+ * @since 3.0.0
* @access public
* @return void
*/
function hybrid_admin_register_styles() {
-
- /* Use the .min stylesheet if SCRIPT_DEBUG is turned off. */
- $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
-
- wp_register_style( 'hybrid-admin-widgets', trailingslashit( HYBRID_CSS ) . "admin-widgets{$suffix}.css" );
+ wp_register_style( 'hybrid-admin', HYBRID_CSS . 'admin.css' );
}
/**
- * Loads the `admin-widgets.css` file when viewing the widgets screen.
+ * Fix for users who want to display content on the posts page above the posts list, which is a
+ * theme feature common to themes built from the framework.
*
- * @since 1.2.0
+ * @since 3.0.0
* @access public
+ * @param object $post
* @return void
*/
-function hybrid_admin_enqueue_styles( $hook_suffix ) {
+function hybrid_enable_posts_page_editor( $post ) {
- if ( current_theme_supports( 'hybrid-core-widgets' ) && 'widgets.php' == $hook_suffix )
- wp_enqueue_style( 'hybrid-admin-widgets' );
+ if ( get_option( 'page_for_posts' ) != $post->ID )
+ return;
+
+ remove_action( 'edit_form_after_title', '_wp_posts_page_notice' );
+ add_post_type_support( $post->post_type, 'editor' );
}
/**
- * Function for getting an array of available custom templates with a specific header. Ideally, this function
+ * Function for getting an array of available custom templates with a specific header. Ideally, this function
* would be used to grab custom singular post (any post type) templates. It is a recreation of the WordPress
* page templates function because it doesn't allow for other types of templates.
*
@@ -91,55 +84,87 @@ function hybrid_admin_enqueue_styles( $hook_suffix ) {
function hybrid_get_post_templates( $post_type = 'post' ) {
global $hybrid;
- /* If templates have already been called, just return them. */
- if ( !empty( $hybrid->post_templates ) && isset( $hybrid->post_templates[ $post_type ] ) )
+ // If templates have already been called, just return them.
+ if ( ! empty( $hybrid->post_templates ) && isset( $hybrid->post_templates[ $post_type ] ) )
return $hybrid->post_templates[ $post_type ];
- /* Else, set up an empty array to house the templates. */
- else
- $hybrid->post_templates = array();
-
- /* Set up an empty post templates array. */
+ // Set up an empty array to house the templates.
$post_templates = array();
- /* Get the post type object. */
- $post_type_object = get_post_type_object( $post_type );
+ // Get the theme PHP files one level deep.
+ $files = wp_get_theme( get_template() )->get_files( 'php', 1 );
- /* Get the theme (parent theme if using a child theme) object. */
- $theme = wp_get_theme( get_template() );
+ // If a child theme is active, get its files and merge with the parent theme files.
+ if ( is_child_theme() )
+ $files = array_merge( $files, wp_get_theme()->get_files( 'php', 1 ) );
+
+ // Loop through each of the PHP files and check if they are post templates.
+ foreach ( $files as $file => $path ) {
- /* Get the theme PHP files one level deep. */
- $files = (array) $theme->get_files( 'php', 1 );
+ // Get file data based on the post type singular name (e.g., "Post Template", "Book Template", etc.).
+ $headers = get_file_data( $path, array( "{$post_type} Template" => "{$post_type} Template" ) );
- /* If a child theme is active, get its files and merge with the parent theme files. */
- if ( is_child_theme() ) {
- $child = wp_get_theme();
- $child_files = (array) $child->get_files( 'php', 1 );
- $files = array_merge( $files, $child_files );
+ // Add the PHP filename and template name to the array.
+ if ( ! empty( $headers["{$post_type} Template"] ) )
+ $post_templates[ $file ] = $headers["{$post_type} Template"];
}
- /* Loop through each of the PHP files and check if they are post templates. */
+ // Add the templates to the global $hybrid object.
+ $hybrid->post_templates[ $post_type ] = array_flip( $post_templates );
+
+ // Return array of post templates.
+ return $hybrid->post_templates[ $post_type ];
+}
+
+/**
+ * Gets the stylesheet files within the parent or child theme and checks if they have the 'Style Name'
+ * header. If any files are found, they are returned in an array.
+ *
+ * @since 3.0.0
+ * @access public
+ * @global object $hybrid
+ * @return array
+ */
+function hybrid_get_post_styles( $post_type = 'post' ) {
+ global $hybrid;
+
+ // If stylesheets have already been loaded, return them.
+ if ( ! empty( $hybrid->post_styles ) && isset( $hybrid->post_styles[ $post_type ] ) )
+ return $hybrid->post_styles[ $post_type ];
+
+ // Set up an empty styles array.
+ $hybrid->post_styles[ $post_type ] = array();
+
+ // Get the theme CSS files two levels deep.
+ $files = wp_get_theme( get_template() )->get_files( 'css', 2 );
+
+ // If a child theme is active, get its files and merge with the parent theme files.
+ if ( is_child_theme() )
+ $files = array_merge( $files, wp_get_theme()->get_files( 'css', 2 ) );
+
+ // Loop through each of the CSS files and check if they are styles.
foreach ( $files as $file => $path ) {
- /* Get file data based on the post type singular name (e.g., "Post Template", "Book Template", etc.). */
+ // Get file data based on the 'Style Name' header.
$headers = get_file_data(
$path,
- array(
- "{$post_type_object->name} Template" => "{$post_type_object->name} Template",
+ array(
+ 'Style Name' => 'Style Name',
+ "{$post_type} Style" => "{$post_type} Style"
)
);
- /* Continue loop if the header is empty. */
- if ( empty( $headers["{$post_type_object->name} Template"] ) )
- continue;
+ // Add the CSS filename and template name to the array.
+ if ( ! empty( $headers['Style Name'] ) )
+ $hybrid->post_styles[ $post_type ][ $file ] = $headers['Style Name'];
- /* Add the PHP filename and template name to the array. */
- $post_templates[ $file ] = $headers["{$post_type_object->name} Template"];
+ elseif ( ! empty( $headers["{$post_type} Style"] ) )
+ $hybrid->post_styles[ $post_type ][ $file ] = $headers["{$post_type} Style"];
}
- /* Add the templates to the global $hybrid object. */
- $hybrid->post_templates[ $post_type ] = array_flip( $post_templates );
+ // Flip the array of styles.
+ $hybrid->post_styles[ $post_type ] = array_flip( $hybrid->post_styles[ $post_type ] );
- /* Return array of post templates. */
- return $hybrid->post_templates[ $post_type ];
+ // Return array of styles.
+ return $hybrid->post_styles[ $post_type ];
}
View
146 admin/meta-box-post-layout.php
@@ -0,0 +1,146 @@
+<?php
+/**
+ * Adds the layout meta box to the post editing screen for post types that support `theme-layouts`.
+ *
+ * @package HybridCore
+ * @subpackage Admin
+ * @author Justin Tadlock <justin@justintadlock.com>
+ * @copyright Copyright (c) 2008 - 2015, Justin Tadlock
+ * @link http://themehybrid.com/hybrid-core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ */
+
+# Add the layout meta box on the 'add_meta_boxes' hook.
+add_action( 'add_meta_boxes', 'hybrid_add_post_layout_meta_box', 10, 2 );
+
+# Saves the post layout on the post editing page.
+add_action( 'save_post', 'hybrid_save_post_layout', 10, 2 );
+add_action( 'add_attachment', 'hybrid_save_post_layout' );
+add_action( 'edit_attachment', 'hybrid_save_post_layout' );
+
+/**
+ * Adds the layout meta box.
+ *
+ * @since 3.0.0
+ * @access public
+ * @param string $post_type
+ * @param object $post
+ * @return void
+ */
+function hybrid_add_post_layout_meta_box( $post_type ) {
+
+ if ( current_theme_supports( 'theme-layouts', 'post_meta' ) && post_type_supports( $post_type, 'theme-layouts' ) && current_user_can( 'edit_theme_options' ) ) {
+
+ // Add meta box.
+ add_meta_box( 'hybrid-post-layout', esc_html__( 'Layout', 'hybrid-core' ), 'hybrid_post_layout_meta_box', $post_type, 'side', 'default' );
+
+ // Load scripts/styles.
+ add_action( 'admin_enqueue_scripts', 'hybrid_post_layout_enqueue', 5 );
+ }
+}
+
+/**
+ * Loads the scripts/styles for the layout meta box.
+ *
+ * @since 3.0.0
+ * @access public
+ * @return void
+ */
+function hybrid_post_layout_enqueue() {
+ wp_enqueue_style( 'hybrid-admin' );
+}
+
+/**
+ * Callback function for displaying the layout meta box.
+ *
+ * @since 3.0.0
+ * @access public
+ * @param object $object
+ * @param array $box
+ * @return void
+ */
+function hybrid_post_layout_meta_box( $post, $box ) {
+
+ // Get the current post's layout.
+ $post_layout = hybrid_get_post_layout( $post->ID );
+
+ $post_layout = $post_layout ? $post_layout : 'default';
+
+ wp_nonce_field( basename( __FILE__ ), 'hybrid-post-layout-nonce' ); ?>
+
+ <?php foreach ( hybrid_get_layouts() as $layout ) : ?>
+
+ <?php if ( true === $layout->is_post_layout && $layout->image && ! ( ! empty( $layout->post_types ) && ! in_array( $post->post_type, $layout->post_types ) ) ) : ?>
+
+ <label class="has-img">
+ <input type="radio" value="<?php echo esc_attr( $layout->name ); ?>" name="hybrid-post-layout" <?php checked( $post_layout, $layout->name ); ?> />
+
+ <span class="screen-reader-text"><?php echo esc_html( $layout->label ); ?></span>
+
+ <img src="<?php echo esc_url( sprintf( $layout->image, get_template_directory_uri(), get_stylesheet_directory_uri() ) ); ?>" alt="<?php echo esc_attr( $layout->label ); ?>" />
+ </label>
+
+ <?php endif; ?>
+
+ <?php endforeach; ?>
+
+ <script type="text/javascript">
+ jQuery( document ).ready( function( $ ) {
+
+ // Add the `.checked` class to whichever radio is checked.
+ $( '#hybrid-post-layout input:checked' ).addClass( 'checked' );
+
+ // When a radio is clicked.
+ $( "#hybrid-post-layout input" ).click( function() {
+
+ // If the radio has the `.checked` class, remove it and uncheck the radio.
+ if ( $( this ).hasClass( 'checked' ) ) {
+
+ $( "#hybrid-post-layout input" ).removeClass( 'checked' );
+ $( this ).prop( 'checked', false );
+
+ // If the radio is not checked, add the `.checked` class and check it.
+ } else {
+
+ $( "#hybrid-post-layout input" ).removeClass( 'checked' );
+ $( this ).addClass( 'checked' );
+ }
+ } );
+ } );
+ </script>
+<?php
+}
+
+/**
+ * Saves the post layout when submitted via the layout meta box.
+ *
+ * @since 3.0.0
+ * @access public
+ * @param int $post_id The ID of the current post being saved.
+ * @param object $post The post object currently being saved.
+ * @return void|int
+ */
+function hybrid_save_post_layout( $post_id, $post = '' ) {
+
+ // Fix for attachment save issue in WordPress 3.5. @link http://core.trac.wordpress.org/ticket/21963
+ if ( ! is_object( $post ) )
+ $post = get_post();
+
+ // Verify the nonce for the post formats meta box.
+ if ( ! isset( $_POST['hybrid-post-layout-nonce'] ) || ! wp_verify_nonce( $_POST['hybrid-post-layout-nonce'], basename( __FILE__ ) ) )
+ return $post_id;
+
+ // Get the previous post layout.
+ $meta_value = hybrid_get_post_layout( $post_id );
+
+ // Get the submitted post layout.
+ $new_meta_value = isset( $_POST['hybrid-post-layout'] ) ? sanitize_key( $_POST['hybrid-post-layout'] ) : '';
+
+ // If there is no new meta value but an old value exists, delete it.
+ if ( '' == $new_meta_value && $meta_value )
+ hybrid_delete_post_layout( $post_id );
+
+ // If a new meta value was added and there was no previous value, add it.
+ elseif ( $meta_value !== $new_meta_value )
+ hybrid_set_post_layout( $post_id, $new_meta_value );
+}
View
99 admin/meta-box-post-style.php
@@ -0,0 +1,99 @@
+<?php
+/**
+ * Adds the post style meta box to the edit post screen.
+ *
+ * @package HybridCore
+ * @subpackage Admin
+ * @author Justin Tadlock <justin@justintadlock.com>
+ * @copyright Copyright (c) 2008 - 2015, Justin Tadlock
+ * @link http://themehybrid.com/hybrid-core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ */
+
+# Add the post stylesheets meta box on the 'add_meta_boxes' hook.
+add_action( 'add_meta_boxes', 'hybrid_add_post_style_meta_box', 10, 2 );
+
+# Saves the post meta box data.
+add_action( 'save_post', 'hybrid_save_post_style', 10, 2 );
+add_action( 'add_attachment', 'hybrid_save_post_style' );
+add_action( 'edit_attachment', 'hybrid_save_post_style' );
+
+/**
+ * Adds the style meta box.
+ *
+ * @since 3.0.0
+ * @access public
+ * @param string $post_type
+ * @param object $post
+ * @return void
+ */
+function hybrid_add_post_style_meta_box( $post_type, $post ) {
+
+ $styles = hybrid_get_post_styles( $post_type );
+
+ if ( ! empty( $styles ) && current_user_can( 'edit_theme_options' ) )
+ add_meta_box( 'hybrid-post-style', esc_html__( 'Style', 'hybrid-core' ), 'hybrid_post_style_meta_box', $post_type, 'side', 'default' );
+}
+
+/**
+ * Callback function for displaying the style meta box.
+ *
+ * @since 3.0.0
+ * @access public
+ * @param object $object
+ * @param array $box
+ * @return void
+ */
+function hybrid_post_style_meta_box( $post, $box ) {
+
+ $styles = hybrid_get_post_styles( $post->post_type );
+ $post_style = hybrid_get_post_style( $post->ID );
+
+ wp_nonce_field( basename( __FILE__ ), 'hybrid-post-style-nonce' ); ?>
+
+ <p>
+ <select name="hybrid-post-style" class="widefat">
+
+ <option value=""></option>
+
+ <?php foreach ( $styles as $label => $file ) : ?>
+ <option value="<?php echo esc_attr( $file ); ?>" <?php selected( $post_style, $file ); ?>><?php echo esc_html( $label ); ?></option>
+ <?php endforeach; ?>
+
+ </select>
+ </p>
+<?php }
+
+/**
+ * Saves the post style when submitted via the style meta box.
+ *
+ * @since 3.0.0
+ * @access public
+ * @param int $post_id The ID of the current post being saved.
+ * @param object $post The post object currently being saved.
+ * @return void|int
+ */
+function hybrid_save_post_style( $post_id, $post = '' ) {
+
+ // Fix for attachment save issue in WordPress 3.5. @link http://core.trac.wordpress.org/ticket/21963
+ if ( ! is_object( $post ) )
+ $post = get_post();
+
+ // Verify the nonce before proceeding.
+ if ( ! isset( $_POST['hybrid-post-style-nonce'] ) || ! wp_verify_nonce( $_POST['hybrid-post-style-nonce'], basename( __FILE__ ) ) )
+ return;
+
+ // Get the previous post style.
+ $meta_value = hybrid_get_post_style( $post_id );
+
+ // Get the submitted post style.
+ $new_meta_value = isset( $_POST['hybrid-post-style'] ) ? sanitize_text_field( $_POST['hybrid-post-style'] ) : '';
+
+ // If there is no new meta value but an old value exists, delete it.
+ if ( '' == $new_meta_value && $meta_value )
+ hybrid_delete_post_style( $post_id );
+
+ // If a new meta value was added and there was no previous value, add it.
+ elseif ( $meta_value !== $new_meta_value )
+ hybrid_set_post_style( $post_id, $new_meta_value );
+}
View
125 admin/meta-box-post-template.php
@@ -1,29 +1,28 @@
<?php
/**
- * Adds the template meta box to the post editing screen for public post types. This feature allows users and
- * devs to create custom templates for any post type, not just pages as default in WordPress core. The
- * functions in this file create the template meta box and save the template chosen by the user when the
+ * Adds the template meta box to the post editing screen for public post types. This feature allows users and
+ * devs to create custom templates for any post type, not just pages as default in WordPress core. The
+ * functions in this file create the template meta box and save the template chosen by the user when the
* post is saved. This file is only used if the theme supports the 'hybrid-core-template-hierarchy' feature.
*
* @package HybridCore
* @subpackage Admin
* @author Justin Tadlock <justin@justintadlock.com>
- * @copyright Copyright (c) 2008 - 2014, Justin Tadlock
+ * @copyright Copyright (c) 2008 - 2015, Justin Tadlock
* @link http://themehybrid.com/hybrid-core
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
-/* Add the post template meta box on the 'add_meta_boxes' hook. */
+# Add the post template meta box on the 'add_meta_boxes' hook.
add_action( 'add_meta_boxes', 'hybrid_meta_box_post_add_template', 10, 2 );
-add_action( 'add_meta_boxes', 'hybrid_meta_box_post_remove_template', 10, 2 );
-/* Save the post template meta box data on the 'save_post' hook. */
+# Save the post template meta box data on the 'save_post' hook.
add_action( 'save_post', 'hybrid_meta_box_post_save_template', 10, 2 );
add_action( 'add_attachment', 'hybrid_meta_box_post_save_template' );
add_action( 'edit_attachment', 'hybrid_meta_box_post_save_template' );
/**
- * Adds the post template meta box for all public post types, excluding the 'page' post type since WordPress
+ * Adds the post template meta box for all public post types, excluding the 'page' post type since WordPress
* core already handles page templates.
*
* @since 1.2.0
@@ -34,42 +33,12 @@
*/
function hybrid_meta_box_post_add_template( $post_type, $post ) {
- /* Get the post templates. */
+ // Get the post templates.
$templates = hybrid_get_post_templates( $post_type );
- /* If no post templates were found for this post type, don't add the meta box. */
- if ( empty( $templates ) )
- return;
-
- $post_type_object = get_post_type_object( $post_type );
-
- /* Only add meta box if current user can edit, add, or delete meta for the post. */
- if ( ( true === $post_type_object->public ) && ( current_user_can( 'edit_post_meta', $post->ID ) || current_user_can( 'add_post_meta', $post->ID ) || current_user_can( 'delete_post_meta', $post->ID ) ) )
- add_meta_box( 'hybrid-core-post-template', __( 'Template', 'hybrid-core' ), 'hybrid_meta_box_post_display_template', $post_type, 'side', 'default' );
-}
-
-/**
- * Remove the meta box from some post types.
- *
- * @since 1.3.0
- * @access public
- * @param string $post_type The post type of the current post being edited.
- * @param object $post The current post being edited.
- * @return void
- */
-function hybrid_meta_box_post_remove_template( $post_type, $post ) {
-
- /* Removes meta box from pages since this is a built-in WordPress feature. */
- if ( 'page' == $post_type )
- remove_meta_box( 'hybrid-core-post-template', 'page', 'side' );
-
- /* Removes meta box from the bbPress 'topic' post type. */
- elseif ( function_exists( 'bbp_get_topic_post_type' ) && bbp_get_topic_post_type() == $post_type )
- remove_meta_box( 'hybrid-core-post-template', bbp_get_topic_post_type(), 'side' );
-
- /* Removes meta box from the bbPress 'reply' post type. */
- elseif ( function_exists( 'bbp_get_reply_post_type' ) && bbp_get_reply_post_type() == $post_type )
- remove_meta_box( 'hybrid-core-post-template', bbp_get_reply_post_type(), 'side' );
+ // If there's templates, add the meta box.
+ if ( ! empty( $templates ) && 'page' !== $post_type )
+ add_meta_box( 'hybrid-post-template', esc_html__( 'Template', 'hybrid-core' ), 'hybrid_meta_box_post_display_template', $post_type, 'side', 'default' );
}
/**
@@ -81,31 +50,28 @@ function hybrid_meta_box_post_remove_template( $post_type, $post ) {
* @param array $box
* @return void
*/
-function hybrid_meta_box_post_display_template( $object, $box ) {
-
- /* Get the post type object. */
- $post_type_object = get_post_type_object( $object->post_type );
+function hybrid_meta_box_post_display_template( $post, $box ) {
- /* Get a list of available custom templates for the post type. */
- $templates = hybrid_get_post_templates( $object->post_type );
+ $templates = hybrid_get_post_templates( $post->post_type );
+ $post_template = hybrid_get_post_template( $post->ID );
- wp_nonce_field( basename( __FILE__ ), 'hybrid-core-post-meta-box-template' ); ?>
+ wp_nonce_field( basename( __FILE__ ), 'hybrid-post-template-nonce' ); ?>
<p>
- <?php if ( 0 != count( $templates ) ) { ?>
- <select name="hybrid-post-template" id="hybrid-post-template" class="widefat">
- <option value=""></option>
- <?php foreach ( $templates as $label => $template ) { ?>
- <option value="<?php echo esc_attr( $template ); ?>" <?php selected( esc_attr( get_post_meta( $object->ID, "_wp_{$post_type_object->name}_template", true ) ), esc_attr( $template ) ); ?>><?php echo esc_html( $label ); ?></option>
- <?php } ?>
- </select>
- <?php } ?>
+ <select name="hybrid-post-template" class="widefat">
+
+ <option value=""></option>
+
+ <?php foreach ( $templates as $label => $template ) : ?>
+ <option value="<?php echo esc_attr( $template ); ?>" <?php selected( $post_template, $template ); ?>><?php echo esc_html( $label ); ?></option>
+ <?php endforeach; ?>
+
+ </select>
</p>
-<?php
-}
+<?php }
/**
- * Saves the post template meta box settings as post metadata. Note that this meta is sanitized using the
+ * Saves the post template meta box settings as post metadata. Note that this meta is sanitized using the
* hybrid_sanitize_meta() callback function prior to being saved.
*
* @since 1.2.0
@@ -116,36 +82,29 @@ function hybrid_meta_box_post_display_template( $object, $box ) {
*/
function hybrid_meta_box_post_save_template( $post_id, $post = '' ) {
- /* Fix for attachment save issue in WordPress 3.5. @link http://core.trac.wordpress.org/ticket/21963 */
- if ( !is_object( $post ) )
+ // Fix for attachment save issue in WordPress 3.5. @link http://core.trac.wordpress.org/ticket/21963
+ if ( ! is_object( $post ) )
$post = get_post();
- /* Verify the nonce before proceeding. */
- if ( !isset( $_POST['hybrid-core-post-meta-box-template'] ) || !wp_verify_nonce( $_POST['hybrid-core-post-meta-box-template'], basename( __FILE__ ) ) )
+ // Verify the nonce before proceeding.
+ if ( ! isset( $_POST['hybrid-post-template-nonce'] ) || ! wp_verify_nonce( $_POST['hybrid-post-template-nonce'], basename( __FILE__ ) ) )
return $post_id;
- /* Return here if the template is not set. There's a chance it won't be if the post type doesn't have any templates. */
- if ( !isset( $_POST['hybrid-post-template'] ) )
+ // Return here if the template is not set. There's a chance it won't be if the post type doesn't have any templates.
+ if ( ! isset( $_POST['hybrid-post-template'] ) || ! current_user_can( 'edit_post', $post_id ) )
return $post_id;
- /* Get the posted meta value. */
- $new_meta_value = $_POST['hybrid-post-template'];
-
- /* Set the $meta_key variable based off the post type name. */
- $meta_key = "_wp_{$post->post_type}_template";
-
- /* Get the meta value of the meta key. */
- $meta_value = get_post_meta( $post_id, $meta_key, true );
+ // Get the posted meta value.
+ $new_meta_value = sanitize_text_field( $_POST['hybrid-post-template'] );
- /* If there is no new meta value but an old value exists, delete it. */
- if ( current_user_can( 'delete_post_meta', $post_id ) && '' == $new_meta_value && $meta_value )
- delete_post_meta( $post_id, $meta_key, $meta_value );
+ // Get the meta value of the meta key.
+ $meta_value = hybrid_get_post_template( $post_id );
- /* If a new meta value was added and there was no previous value, add it. */
- elseif ( current_user_can( 'add_post_meta', $post_id, $meta_key ) && $new_meta_value && '' == $meta_value )
- add_post_meta( $post_id, $meta_key, $new_meta_value, true );
+ // If there is no new meta value but an old value exists, delete it.
+ if ( '' == $new_meta_value && $meta_value )
+ hybrid_delete_post_template( $post_id );
- /* If the new meta value does not match the old value, update it. */
- elseif ( current_user_can( 'edit_post_meta', $post_id ) && $new_meta_value && $new_meta_value != $meta_value )
- update_post_meta( $post_id, $meta_key, $new_meta_value );
+ // If the new meta value does not match the old value, update it.
+ elseif ( $new_meta_value != $meta_value )
+ hybrid_set_post_template( $post_id, $new_meta_value );
}
View
247 admin/theme-settings.php
@@ -1,247 +0,0 @@
-<?php
-/**
- * Handles the display and functionality of the theme settings page. This feature is merely a wrapper for the
- * WordPress Settings API. It creates the appropriate screen and HTML output for the settings page. This file
- * is only loaded if the theme supports the 'hybrid-core-theme-settings' feature.
- *
- * Note that the use of this feature is discouraged. Theme authors are recommended to use the WordPress
- * Theme Customizer API instead. However, there are scenarios where non-stylistic theme options are needed.
- * That's the purpose of this feature.
- *
- * To register default settings, devs should use the `{$prefix}_default_theme_settings` filter hook. To
- * validate/sanitize data from custom settings, devs should use the `sanitize_option_{$prefix}_theme_settings`
- * filter hook. Use `appearance_page-theme-settings` as the `$page` ID when registering settings sections
- * and settings fields.
- *
- * @package HybridCore
- * @subpackage Admin
- * @author Justin Tadlock <justin@justintadlock.com>
- * @copyright Copyright (c) 2008 - 2014, Justin Tadlock
- * @link http://themehybrid.com/hybrid-core
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
- */
-
-/**
- * Creates a settings field id attribute for use on the theme settings page. This is a helper function for use
- * with the WordPress settings API.
- *
- * @since 1.0.0
- * @access public
- * @param string $setting
- * @return string
- */
-function hybrid_settings_field_id( $setting ) {
- return hybrid_get_prefix() . '_theme_settings-' . sanitize_html_class( $setting );
-}
-
-/**
- * Creates a settings field name attribute for use on the theme settings page. This is a helper function for
- * use with the WordPress settings API.
- *
- * @since 1.0.0
- * @access public
- * @param string $setting
- * @return string
- */
-function hybrid_settings_field_name( $setting ) {
- return hybrid_get_prefix() . "_theme_settings[{$setting}]";
-}
-
-/**
- * Creates a theme settings page for the theme.
- *
- * @since 2.0.0
- * @access public
- */
-final class Hybrid_Theme_Settings{
-
- /**
- * Holds the instance of this class.
- *
- * @since 2.0.0
- * @access private
- * @var object
- */
- private static $instance;
-
- /**
- * Holds the object returned from wp_get_theme().
- *
- * @since 2.0.0
- * @access public
- * @var object
- */
- public $theme;
-
- /**
- * Theme prefix. Defaults to the value of get_template().
- *
- * @since 2.0.0
- * @access public
- * @var string
- */
- public $prefix = '';
-
- /**
- * Holds an array the theme settings.
- *
- * @since 2.0.0
- * @access public
- * @var array
- */
- public $settings = array();
-
- /**
- * Settings page name.
- *
- * @since 2.0.0
- * @access public
- * @var string
- */
- public $settings_page = 'appearance_page_theme-settings';
-
- /**
- * Sets up the theme admin.
- *
- * @since 2.0.0
- * @access public
- * @return void
- */
- public function __construct() {
-
- /* Add theme settings to the admin menu. */
- add_action( 'admin_menu', array( $this, 'admin_menu' ), 5 );
-
- /* Get the theme object. */
- $this->theme = wp_get_theme( get_template() );
-
- /* Get the theme prefix. */
- $this->prefix = hybrid_get_prefix();
- }
-
- /**
- * Adds the settings page to the admin menu.
- *
- * @since 2.0.0
- * @access public
- * @return void
- */
- public function admin_menu() {
-
- /* Add the theme settings page. */
- $this->settings_page = add_theme_page(
- /* Translators: %s is the theme name. */
- sprintf( esc_html__( '%s Theme Settings', 'hybrid-core' ), $this->theme->display( 'Name', false, true ) ),
- esc_html__( 'Theme Settings', 'hybrid-core' ),
- 'edit_theme_options',
- 'theme-settings',
- array( $this, 'settings_page' )
- );
-
- /* If the theme settings page was created for the current user. */
- if ( !empty( $this->settings_page ) ) {
-
- /* Register the theme settings. */
- add_action( 'admin_init', array( $this, 'register_settings' ) );
-
- /* Add help tabs. */
- add_action( "load-{$this->settings_page}", array( $this, 'add_help_tabs' ), 5 );
- }
- }
-
- /**
- * Registers the plugin settings and sets up the settings sections and fields.
- *
- * @since 2.0.0
- * @access public
- * @return void
- */
- public function register_settings() {
-
- /* Register theme settings. */
- register_setting(
- "{$this->prefix}_theme_settings", // Options group.
- "{$this->prefix}_theme_settings", // Database option.
- array( $this, 'validate_settings' ) // Validation callback function.
- );
-
- /* Get the plugin settings from the database. */
- $this->settings = get_option(
- "{$this->prefix}_theme_settings",
- hybrid_get_default_theme_settings()
- );
- }
-
- /**
- * Validates the plugin settings once the form has been submitted.
- *
- * @since 2.0.0
- * @access public
- * @return void
- */
- public function validate_settings( $settings ) {
- return $settings;
- }
-
- /**
- * Displays the HTML and uses the required functions for creating the plugin settings page.
- *
- * @since 2.0.0
- * @access public
- * @return void
- */
- public function settings_page() { ?>
-
- <div class="wrap">
-
- <h2><?php
- /* Translators: %s is the theme name. */
- printf( __( '%s Theme Settings', 'hybrid-core' ), $this->theme->display( 'Name', false, true ) );
- ?></h2>
-
- <?php settings_errors(); ?>
-
- <form method="post" action="options.php">
- <?php settings_fields( "{$this->prefix}_theme_settings" ); ?>
- <?php do_settings_sections( $this->settings_page ); ?>
- <?php submit_button( '', 'primary' ); ?>
- </form>
-
- </div><!-- wrap -->
- <?php }
-
- /**
- * Adds help tabs to the settings screen.
- *
- * @since 2.0.0
- * @access public
- * @return void
- */
- public function add_help_tabs() {
-
- get_current_screen()->add_help_tab(
- array(
- 'id' => 'default',
- 'title' => $this->theme->display( 'Name', false, true ),
- 'content' => wpautop( $this->theme->display( 'Description', true, true ) ),
- )
- );
- }
-
- /**
- * Returns the instance.
- *
- * @since 2.0.0
- * @access public
- * @return object
- */
- public static function get_instance() {
-
- if ( !self::$instance )
- self::$instance = new self;
-
- return self::$instance;
- }
-}
-
-Hybrid_Theme_Settings::get_instance();
View
111 changelog.md
@@ -0,0 +1,111 @@
+# Change Log
+
+You can see the changes made via the [commit log](https://github.com/justintadlock/hybrid-core/commits/master) for the latest release.
+
+## [3.0.0] - 2015-08-17
+
+### Added
+
+* Media grabber now supports the `[gallery]` shortcode.
+* Custom attributes can now be passed into `hybrid_attr()`.
+* Fix for core WP issues that doesn't allow users to edit the posts page content.
+* Separated One Five style into `one-five.css` and `one-five-rtl.css`.
+* Added color palette customizer control.
+* Added multiple checkbox customizer control.
+* Added dropdown terms customizer control.
+* Added layout customizer control.
+* Added radio image customizer control.
+* Added select customizer control that supports `<optgroup>`.
+* Added multiple select customizer control.
+* Added array map customizer setting.
+* Added image data customizer setting.
+* Complete overhaul of theme layouts with a new Layouts API and many UI and other improvements.
+* The post class now has the `.has-pages` class when it's a paged post.
+* New `Hybrid_Chat` class that better handles chat posts.
+* New `hybrid_is_plural()` function to go along with core WP's `is_singular()`.
+* New `hybrid_get_attachment_type()` and `hybrid_get_attachment_subtype()` functions for getting attachment mime types.
+* WordPress.org and theme URLs now use the translated URLs if available so that translators can link to language-specific pages/sites.
+* Language-specific PHP files are now loaded from the child theme (first) and parent theme.
+* New media metadata class and functions. This makes it easy to get media file metadata for attachments (limited to audio, video, and images).
+* Adds context-based classes to sidebars and menus.
+* Post stylesheets extension now built into the framework. Added extra functions.
+* Added extra functions for working with post templates.
+* Adds support for WP's `title-tag` feature.
+
+### Changed
+
+* `Hybrid` class now loads a few things at different priorities for more flexibility.
+* Files and folders were renamed and restructured to make a bit more sense.
+* Only load extensions if both the theme supports them and if the file exists.
+* Overhauled the constants.
+* Coding style updates. PHPDoc blocks stay the same. Single-line comments within functions now use `//` and single-line comments within the file use `#`.
+* The theme-specific "template" `<meta>` tag is now a "generator" `<meta>` tag.
+* All framework constants have a trailing slash.
+
+### Deprecated
+
+* `hybrid_loop_title()` in favor of WP's `the_archive_title()`.
+* `hybrid_loop_description()` in favor of WP's `the_achive_description()`.
+* `loop_pagination()` in favor of WP's `the_posts_pagination()`.
+* `hybrid_get_attachment_id_from_url()` in favor of WP's `attachment_url_to_postid()`.
+
+### Removed
+
+* Dropped the `hybrid_is_textdomain_loaded()` functionality (wasn't used since 2.0.0).
+* `reset.css` stylesheet.
+* `hybrid-core-styles` and `hybrid-core-scripts`. The specific styles/scripts are now registered, leaving the enqueue to theme authors.
+* Filter on image size names.
+* Filter on id3 keys.
+* Several text strings in an effort to make the framework have as few text strings as possible.
+* `hybrid_admin_setup()`, which was not really needed.
+* Title attributes for most everything for better accessibility.
+* bbPress theme support filter removal.
+* Atomic hooks functionality.
+* Random Custom Background extension.
+* Featured Header extension.
+* Cleaner Caption extension.
+* Custom background customizer control.
+* Textarea customizer control.
+* Old, unused wrapper for admin theme settings page. Use the customizer!
+* Admin widgets screen CSS file.
+
+### Fixed
+
+* Schema.org comment microdata brought up to date.
+* Schema.org body/content/post errors.
+* Media grabber fix when WP auto-embed returns a shortcode.
+* Fixed invalid `itemprop` attribute for comment reply link with no space.
+
+### Security
+
+* Many text strings are now escaped on output to harden security.
+* Better escaping over URLs to harden security.
+
+## Past change logs
+
+Versions prior to 3.0.0 do not have change logs. However, you can view the commit logs for each version.
+
+* [2.0.4](https://github.com/justintadlock/hybrid-core/tree/2.0.4)
+* [2.0.3](https://github.com/justintadlock/hybrid-core/tree/2.0.3)
+* [2.0.2](https://github.com/justintadlock/hybrid-core/tree/2.0.2)
+* [2.0.1](https://github.com/justintadlock/hybrid-core/tree/2.0.1)
+* [2.0.0](https://github.com/justintadlock/hybrid-core/commits/2.0)
+* [1.6.2](https://github.com/justintadlock/hybrid-core/tree/1.6.2)
+* [1.6.1](https://github.com/justintadlock/hybrid-core/tree/1.6.1)
+* [1.6.0](https://github.com/justintadlock/hybrid-core/tree/1.6.0)
+* [1.5.5](https://github.com/justintadlock/hybrid-core/tree/1.5.5)
+* [1.5.4](https://github.com/justintadlock/hybrid-core/tree/1.5.4)
+* [1.5.3](https://github.com/justintadlock/hybrid-core/tree/1.5.3)
+* [1.5.2](https://github.com/justintadlock/hybrid-core/tree/1.5.2)
+* [1.5.1](https://github.com/justintadlock/hybrid-core/tree/1.5.1)
+* [1.5.0](https://github.com/justintadlock/hybrid-core/tree/1.5)
+* [1.4.3](https://github.com/justintadlock/hybrid-core/tree/1.4.3)
+* [1.4.2](https://github.com/justintadlock/hybrid-core/tree/1.4.2)
+* [1.4.1](https://github.com/justintadlock/hybrid-core/tree/1.4.1)
+* [1.4.0](https://github.com/justintadlock/hybrid-core/tree/1.4)
+* [1.3.1](https://github.com/justintadlock/hybrid-core/tree/1.3.1)
+* [1.3.0](https://github.com/justintadlock/hybrid-core/tree/1.3)
+* [1.2.1](https://github.com/justintadlock/hybrid-core/tree/1.2.1)
+* [1.2.0](https://github.com/justintadlock/hybrid-core/tree/1.2)
+* [1.1.1](https://github.com/justintadlock/hybrid-core/tree/1.1.1)
+* [1.1.0](https://github.com/justintadlock/hybrid-core/tree/1.1)
View
89 classes/customize-control-background-image.php
@@ -1,89 +0,0 @@
-<?php
-/**
- * Extends the WordPress background image customize control class, which allows a theme to register
- * multiple default backgrounds for the user to choose from. To use this, the theme author
- * should remove the 'background_image' control and add this control in its place.
- *
- * @package Hybrid
- * @subpackage Classes
- * @author Justin Tadlock <justin@justintadlock.com>
- * @copyright Copyright (c) 2008 - 2014, Justin Tadlock
- * @link http://themehybrid.com/hybrid-core
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
- */
-
-/**
- * Background image customize control class.
- *
- * @since 2.0.0
- */
-class Hybrid_Customize_Control_Background_Image extends WP_Customize_Background_Image_Control {
-
- /**
- * Array of default backgrounds.
- *
- * @since 2.0.0
- * @access public
- * @var array
- */
- public $default_backgrounds = array();
-
- /**
- * Set up our control.
- *
- * @since 2.0.0
- * @access public
- * @param object $manager
- * @return void
- */
- public function __construct( $manager ) {
-
- /* Let WP handle this. */
- parent::__construct( $manager );
-
- /* Allow themes to register custom backgrounds. */
- $this->default_backgrounds = apply_filters( 'hybrid_default_backgrounds', $this->default_backgrounds );
-
- /* WordPress will only output the 'default' tab if there's a default image. Make sure it gets added. */
- if ( !$this->setting->default && !empty( $this->default_backgrounds ) )
- $this->add_tab( 'default', _x( 'Default', 'theme customizer tab', 'hybrid-core' ), array( $this, 'tab_default_background' ) );
- }
-
- /**
- * Displays the 'default' tab for selecting a background image. This method plays nicely with the
- * 'default-image' argument for 'custom-background' as well as our custom backgrounds.
- *
- * @since 2.0.0
- * @access public
- * @return void
- */
- public function tab_default_background() {
-
- /* If the theme added a 'default-image', make sure to output it. */
- if ( $this->setting->default )
- $this->print_tab_image( $this->setting->default );
-
- /* Check if the theme added an array of default backgrounds. */
- if ( !empty( $this->default_backgrounds ) ) {
-
- /* Get the template and stylesheet directory URIs. */
- $template = get_template_directory_uri();
- $stylesheet = get_stylesheet_directory_uri();
-
- /* Loop through the backgrounds and print them. */
- foreach ( $this->default_backgrounds as $background ) {
-
- /* If no thumbnail was given, use the original. */
- if ( !isset( $background['thumbnail_url'] ) )
- $background['thumbnail_url'] = $background['url'];
-
- /* Use '%s' for parent themes and '%2$s' for child themes. */
- $url = sprintf( $background['url'], $template, $stylesheet );
- $thumb_url = sprintf( $background['thumbnail_url'], $template, $stylesheet );
-
- /* Print the image. */
- $this->print_tab_image( $url, $thumb_url );
- }
- }
- }
-}
View
41 classes/customize-control-textarea.php
@@ -1,41 +0,0 @@
-<?php
-/**
- * The textarea customize control extends the WP_Customize_Control class. This class allows
- * developers to create textarea settings within the WordPress theme customizer.
- *
- * @package Hybrid
- * @subpackage Classes
- * @author Justin Tadlock <justin@justintadlock.com>
- * @copyright Copyright (c) 2008 - 2014, Justin Tadlock
- * @link http://themehybrid.com/hybrid-core
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
- */
-
-/**
- * Textarea customize control class.
- *
- * @since 1.4.0
- */
-class Hybrid_Customize_Control_Textarea extends WP_Customize_Control {
-
- /**
- * The type of customize control being rendered.
- *
- * @since 1.4.0
- */
- public $type = 'textarea';
-
- /**
- * Displays the textarea on the customize screen.
- *
- * @since 1.4.0
- */
- public function render_content() { ?>
- <label>
- <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
- <div class="customize-control-content">
- <textarea class="widefat" cols="45" rows="5" <?php $this->link(); ?>><?php echo esc_textarea( $this->value() ); ?></textarea>
- </div>
- </label>
- <?php }
-}
View
301 classes/hybrid-media-meta.php
@@ -1,301 +0,0 @@
-<?php
-/**
- * Class for getting and formatting attachment metadata. The class currently handles attachment metadata for
- * the image, audio, and video mime types. It may handle other types in the future, depending on the direction
- * of WordPress core. The purpose of this class is wrap up the return values of the core WP function
- * `wp_get_attachment_metadata()` into a more usuable format for theme authors so that they can easily display
- * data related to media in their themes.
- *
- * @package Hybrid
- * @subpackage Classes
- * @author Justin Tadlock <justin@justintadlock.com>
- * @copyright Copyright (c) 2008 - 2014, Justin Tadlock
- * @link http://themehybrid.com/hybrid-core
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
- */
-
-/**
- * Wrapper function for the Hybrid_Media_Meta class.
- *
- * @since 2.0.0
- * @access public
- * @param array $args
- * @return string
- */
-function hybrid_media_meta( $args = array() ) {
-
- $meta = new Hybrid_Media_Meta( $args );
-
- return $meta->display();
-}
-
-/**
- * Class for getting and formatting attachment metadata.
- *
- * @since 2.0.0
- * @access public
- */
-class Hybrid_Media_Meta {
-
- /**
- * Arguments passed in.
- *
- * @since 2.0.0
- * @access public
- * @var array
- */
- public $args = array();
-
- /**
- * Metadata from the wp_get_attachment_metadata() function.
- *
- * @since 2.0.0
- * @access public
- * @var array
- */
- public $meta = array();
-
- /**
- * Array of items found and formatted.
- *
- * @since 2.0.0
- * @access public
- * @var array
- */
- public $items = array();
-
- /**
- * Sets up and runs the functionality for getting the attachment meta.
- *
- * @since 2.0.0
- * @access public
- * @param array $args
- * @return void
- */
- public function __construct( $args = array() ) {
-
- $defaults = array(
- 'post_id' => get_the_ID(),
- 'labels' => array(),
- 'echo' => true,
- );
-
- $this->args = apply_filters( 'hybrid_media_meta_args', wp_parse_args( $args, $defaults ) );
-
- /* Get the attachment metadata. */
- $this->meta = wp_get_attachment_metadata( $this->args['post_id'] );
-
- /* If the attachment is an image. */
- if ( wp_attachment_is_image( $this->args['post_id'] ) )
- $this->image_meta();
-
- /* If the attachment is audio. */
- elseif ( hybrid_attachment_is_audio( $this->args['post_id'] ) )
- $this->audio_meta();
-
- /* If the attachment is video. */
- elseif ( hybrid_attachment_is_video( $this->args['post_id'] ) )
- $this->video_meta();
- }
-
- /**
- * Returns the array of formatted meta items.
- *
- * @since 2.0.0
- * @access public
- * @return array
- */
- public function get_items() {
- return $this->items;
- }
-
- /**
- * Returns or outputs a list of formatted attachment meta.
- *
- * @since 2.0.0
- * @access public
- * @return string
- */
- public function display() {
-
- $display = '';
-
- /* If the items array isn't empty. */
- if ( !empty( $this->items ) ) {
-
- /* Format each of the items. */
- foreach ( $this->items as $item )
- $display .= sprintf( '<li><span class="prep">%s</span> <span class="data">%s</span></li>', $item[1], $item[0] );
-
- /* Add the items to a list. */
- $display = '<ul class="media-meta">' . $display . '</ul>';
- }
-
- if ( true === $this->args['echo'] )
- echo $display;
- else
- return $display;
- }
-
- /**
- * Adds and formats image metadata for the items array.
- *
- * @since 2.0.0
- * @access public
- * @return void
- */
- public function image_meta() {
-
- /* If there's a width and height. */
- if ( !empty( $this->meta['width'] ) && !empty( $this->meta['height'] ) ) {
-
- $this->items['dimensions'] = array(
- /* Translators: Media dimensions - 1 is width and 2 is height. */
- '<a href="' . esc_url( wp_get_attachment_url() ) . '">' . sprintf( __( '%1$s &#215; %2$s', 'hybrid-core' ), number_format_i18n( absint( $this->meta['width'] ) ), number_format_i18n( absint( $this->meta['height'] ) ) ) . '</a>',
- __( 'Dimensions', 'hybrid-core' )
- );
- }
-
- /* If a timestamp exists, add it to the $items array. */
- if ( !empty( $this->meta['image_meta']['created_timestamp'] ) )
- $this->items['created_timestamp'] = array( date_i18n( get_option( 'date_format' ), strip_tags( $this->meta['image_meta']['created_timestamp'] ) ), __( 'Date', 'hybrid-core' ) );
-
- /* If a camera exists, add it to the $items array. */
- if ( !empty( $this->meta['image_meta']['camera'] ) )
- $this->items['camera'] = array( esc_html( $this->meta['image_meta']['camera'] ), __( 'Camera', 'hybrid-core' ) );
-
- /* If an aperture exists, add it to the $items array. */
- if ( !empty( $this->meta['image_meta']['aperture'] ) )
- $this->items['aperture'] = array( sprintf( '<sup>f</sup>&#8260;<sub>%s</sub>', absint( $this->meta['image_meta']['aperture'] ) ), __( 'Aperture', 'hybrid-core' ) );
-
- /* If a focal length is set, add it to the $items array. */
- if ( !empty( $this->meta['image_meta']['focal_length'] ) )
- /* Translators: Camera focal length. */
- $this->items['focal_length'] = array( sprintf( __( '%s mm', 'hybrid-core' ), absint( $this->meta['image_meta']['focal_length'] ) ), __( 'Focal Length', 'hybrid-core' ) );
-
- /* If an ISO is set, add it to the $items array. */
- if ( !empty( $this->meta['image_meta']['iso'] ) ) {
- $this->items['iso'] = array(
- absint( $this->meta['image_meta']['iso'] ),
- '<abbr title="' . __( 'International Organization for Standardization', 'hybrid-core' ) . '">' . __( 'ISO', 'hybrid-core' ) . '</abbr>'
- );
- }
-
- /* If a shutter speed is given, format the float into a fraction and add it to the $items array. */
- if ( !empty( $this->meta['image_meta']['shutter_speed'] ) ) {
-
- $this->meta['image_meta']['shutter_speed'] = floatval( $this->meta['image_meta']['shutter_speed'] );
-
- if ( ( 1 / $this->meta['image_meta']['shutter_speed'] ) > 1 ) {
- $shutter_speed = '<sup>' . number_format_i18n( 1 ) . '</sup>&#8260;';
-
- if ( number_format( ( 1 / $this->meta['image_meta']['shutter_speed'] ), 1 ) == number_format( ( 1 / $this->meta['image_meta']['shutter_speed'] ), 0 ) )
- $shutter_speed .= sprintf( '<sub>%s</sub>', number_format_i18n( ( 1 / $this->meta['image_meta']['shutter_speed'] ), 0, '.', '' ) );
- else
- $shutter_speed .= sprintf( '<sub>%s</sub>', number_format_i18n( ( 1 / $this->meta['image_meta']['shutter_speed'] ), 1, '.', '' ) );
- } else {
- $shutter_speed = $this->meta['image_meta']['shutter_speed'];
- }
-
- /* Translators: Camera shutter speed. "sec" is an abbreviation for "seconds". */
- $this->items['shutter_speed'] = array( sprintf( __( '%s sec', 'hybrid-core' ), $shutter_speed ), __( 'Shutter Speed', 'hybrid-core' ) );
- }
- }
-
- /**
- * Adds and formats audio metadata for the items array.
- *
- * Note that we're purposely leaving out the "transcript/lyrics" metadata in this instance. This
- * is because it doesn't fit in well with how other metadata works on display. There's a separate
- * function for that called `hybrid_get_audio_transcript()`.
- *
- * @since 2.0.0
- * @access public
- * @return void
- */
- public function audio_meta() {
-
- /* Get ID3 keys (labels for metadata). */
- $id3_keys = wp_get_attachment_id3_keys( get_post( $this->args['post_id'] ) );
-
- /* Formated length of time the audio file runs. */
- if ( !empty( $this->meta['length_formatted'] ) )
- $this->items['length_formatted'] = array( esc_html( $this->meta['length_formatted'] ), $id3_keys['length_formatted'] );
-
- /* Artist. */
- if ( !empty( $this->meta['artist'] ) )
- $this->items['artist'] = array( esc_html( $this->meta['artist'] ), $id3_keys['artist'] );
-
- /* Composer. */
- if ( !empty( $this->meta['composer'] ) )
- $this->items['composer'] = array( esc_html( $this->meta['composer'] ), $id3_keys['composer'] );
-
- /* Album. */
- if ( !empty( $this->meta['album'] ) )
- $this->items['album'] = array( esc_html( $this->meta['album'] ), $id3_keys['album'] );
-
- /* Track number (should also be an album if this is set). */
- if ( !empty( $this->meta['track_number'] ) )
- $this->items['track_number'] = array( absint( $this->meta['track_number'] ), $id3_keys['track_number'] );
-
- /* Year. */
- if ( !empty( $this->meta['year'] ) )
- $this->items['year'] = array( absint( $this->meta['year'] ), $id3_keys['year'] );
-
- /* Genre. */
- if ( !empty( $this->meta['genre'] ) )
- $this->items['genre'] = array( esc_html( $this->meta['genre'] ), $id3_keys['genre'] );
-
- /* File name. We're linking this to the actual file URL. */
- $this->items['file_name'] = array( '<a href="' . esc_url( wp_get_attachment_url( $this->args['post_id'] ) ) . '">' . basename( get_attached_file( $this->args['post_id'] ) ) . '</a>', __( 'File Name', 'hybrid-core' ) );
-
- /* File size. */
- if ( !empty( $this->meta['filesize'] ) )
- $this->items['filesize'] = array( size_format( strip_tags( $this->meta['filesize'] ), 2 ), $id3_keys['filesize'] );
-
- /* File type (the metadata for this can be incorrect, so we're just looking at the actual file). */
- if ( preg_match( '/^.*?\.(\w+)$/', get_attached_file( $this->args['post_id'] ), $matches ) )
- $this->items['file_type'] = array( esc_html( strtoupper( $matches[1] ) ), __( 'File Type', 'hybrid-core' ) );
-
- /* Mime type. */
- if ( !empty( $this->meta['mime_type'] ) )
- $this->items['mime_type'] = array( esc_html( $this->meta['mime_type'] ), $id3_keys['mime_type'] );
- }
-
- /**
- * Adds and formats video meta data for the items array.
- *
- * @since 2.0.0
- * @access public
- * @return void
- */
- public function video_meta() {
-
- /* Get ID3 keys (labels for metadata). */
- $id3_keys = wp_get_attachment_id3_keys( get_post( $this->args['post_id'] ) );
-
- /* Formated length of time the video file runs. */
- if ( !empty( $this->meta['length_formatted'] ) )
- $this->items['length_formatted'] = array( esc_html( $this->meta['length_formatted'] ), $id3_keys['length_formatted'] );
-
- /* Dimensions (width x height in pixels). */
- if ( !empty( $this->meta['width'] ) && !empty( $this->meta['height'] ) )
- /* Translators: Media dimensions - 1 is width and 2 is height. */
- $this->items['dimensions'] = array( sprintf( __( '%1$s &#215; %2$s', 'hybrid-core' ), number_format_i18n( absint( $this->meta['width'] ) ), number_format_i18n( absint( $this->meta['height'] ) ) ), __( 'Dimensions', 'hybrid-core' ) );
-
- /* File name. We're linking this to the actual file URL. */
- $this->items['file_name'] = array( '<a href="' . esc_url( wp_get_attachment_url( $this->args['post_id'] ) ) . '">' . basename( get_attached_file( $this->args['post_id'] ) ) . '</a>', __( 'File Name', 'hybrid-core' ) );
-
- /* File size. */
- if ( !empty( $this->meta['filesize'] ) )
- $this->items['filesize'] = array( size_format( strip_tags( $this->meta['filesize'] ), 2 ), $id3_keys['filesize'] );
-
- /* File type (the metadata for this can be incorrect, so we're just looking at the actual file). */
- if ( preg_match( '/^.*?\.(\w+)$/', get_attached_file( $this->args['post_id'] ), $matches ) )
- $this->items['file_type'] = array( esc_html( strtoupper( $matches[1] ) ), __( 'File Type', 'hybrid-core' ) );
-
- /* Mime type. */
- if ( !empty( $this->meta['mime_type'] ) )
- $this->items['mime_type'] = array( esc_html( $this->meta['mime_type'] ), $id3_keys['mime_type'] );
- }
-}
View
35 contributing.md
@@ -0,0 +1,35 @@
+# Contributing
+
+The code for the framework is handled via its [GitHub Repository](https://github.com/justintadlock/hybrid-core). You can open tickets, create patches, and send pull requests there.
+
+## Pull requests
+
+Problem first. Solution second.
+
+Pull requests should have a ticket open for discussion first. I rarely accept pull requests that aren't for a specific issue for various reasons. It's far better to post an issue and let me or the community provide feedback prior to creating a pull request.
+
+Please don't make pull requests against the `master` branch. This is the latest, stable code. You can make a pull request against one of the point branches or the `dev` (future release) branch.
+
+## Theme review guidelines
+
+Hybrid Core is developed with the WordPress.org [theme review guidelines](https://make.wordpress.org/themes/handbook/review) in mind. While the framework is not a theme in and of itself, many theme authors use it within their themes on the official theme repository. These guidelines should sufficiently cover any other marketplace or theme shop rules for submission. All new features and code changes must abide by these guidelines to make it into the project.
+
+## Coding standards
+
+In general, Hybrid Core follows all WordPress [coding standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards). There are instances where it doesn't, opting for personal choices of my own, but in terms of contributing, following the WordPress standards is best practice.
+
+## Script and style files
+
+The framework consists of several script and style files. When making patches or pull requests with changes to these files, only do so to the primary file. Don't create patches for the minified (`.min`) versions of the files. Those will be minified after a patch is merged into the code base.
+
+## Language
+
+All text strings follow U.S. English by default. While such guides are generally unneeded, in cases where style considerations are necessary, these will typically follow conventions laid out in *Elements of Style* or the *AP Stylebook*.
+
+## Licensing
+
+Any code contributed to Hybrid Core via patches, pull requests, or other means will be licensed under the [GPL version 2](http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) or later. By contributing code to the project, you provide consent to use such code under this license. The exception to this rule is when bringing in third-party code with an alternate open source license.
+
+## Versioning
+
+Hybrid Core uses [semantic versioning](http://semver.org). Version numbers will look like `3.2.1` where `3` is the "major" release, `2` is the minor release, and `1` is the patch release.
View
70 css/admin-widgets.css
@@ -1,70 +0,0 @@
-/* Theme settings page. */
-.appearance_page_theme-settings .side .form-table th {
- width: 20%;
- font-weight: bold;
- text-align: left;
- padding-left: 0;
- }
-.appearance_page_theme-settings .metabox-holder textarea {
- width: 100%;
- }
-
-/* Post edit screen. */
-.custom-post-format-wrap, .post-layout-wrap {
- padding: 0 5px;
- max-height: 170px;
- overflow-y: auto;
- }
-.hybrid-post-settings {
- padding-top: 5px;
- }
-.hybrid-post-settings p {
- margin-bottom: 15px !important;
- }
-
-/* Widgets page. */
-
-/* Fixes the MP6 Plugin's small container issue that doesn't allow widget controls to expand. */
-.widgets-php div.widget-liquid-right div.widgets-holder-wrap {
- width: 100%;
-}
-
-.widgets-php .columns-1 {
- }
-.widgets-php .columns-2 {
- overflow: hidden;
- float: left;
- width: 48%;
- }
-.widgets-php .columns-3 {
- overflow: hidden;
- float: left;
- width: 31%;
- margin-right: 3.5%;
- }
-.widgets-php .column-last {
- float: right;
- margin-right: 0;
- }
-
-.widgets-php .hybrid-widget-controls label {
- font-size: 11px;
- }
-.widgets-php .columns-2 input.widefat, .widgets-php .columns-2 select.widefat {
- width: 99%;
- }
-.widgets-php .columns-3 select.widefat {
- width: 98.5%;
- }
-.widgets-php .hybrid-widget-controls select[multiple="multiple"] {
- width: 100%;
- height: 5.0em !important;
- }
-.widgets-php input.smallfat {
- float: right;
- width: 66px;
- }
-.widgets-php select.smallfat {
- float: right;
- min-width: 66px;
- }
View
1  css/admin-widgets.min.css
@@ -1 +0,0 @@
-.appearance_page_theme-settings .side .form-table th{width:20%;font-weight:bold;text-align:left;padding-left:0}.appearance_page_theme-settings .metabox-holder textarea{width:100%}.custom-post-format-wrap,.post-layout-wrap{padding:0 5px;max-height:170px;overflow-y:auto}.hybrid-post-settings{padding-top:5px}.hybrid-post-settings p{margin-bottom:15px !important}.widgets-php div.widget-liquid-right div.widgets-holder-wrap{width:100%}.widgets-php .columns-1{}.widgets-php .columns-2{overflow:hidden;float:left;width:48%}.widgets-php .columns-3{overflow:hidden;float:left;width:31%;margin-right:3.5%}.widgets-php .column-last{float:right;margin-right:0}.widgets-php .hybrid-widget-controls label{font-size:11px}.widgets-php .columns-2 input.widefat,.widgets-php .columns-2 select.widefat{width:99%}.widgets-php .columns-3 select.widefat{width:98.5%}.widgets-php .hybrid-widget-controls select[multiple="multiple"]{width:100%;height:5.0em !important}.widgets-php input.smallfat{float:right;width:66px}.widgets-php select.smallfat{float:right;min-width:66px}
View
30 css/admin.css
@@ -0,0 +1,30 @@
+/**
+ * Admin Stylesheet.
+ */
+
+/* === Radio Image Control (Post Layout) === */
+
+#hybrid-post-layout .has-img input[type="radio"] {
+ clip: rect(1px, 1px, 1px, 1px);
+ height: 1px;
+ overflow: hidden;
+ position: absolute !important;
+ width: 1px;
+}
+
+#hybrid-post-layout img {
+ box-sizing: border-box;
+ max-width: 100%;
+ height: auto;
+ padding: 1px;
+ border: 4px solid transparent;
+}
+
+ #hybrid-post-layout img:hover,
+ #hybrid-post-layout img:focus {
+ border-color: #ddd;
+ }
+
+ #hybrid-post-layout input:checked + span + img {
+ border-color: #00a0d2;
+ }
View
1  css/admin.min.css
@@ -0,0 +1 @@
+#hybrid-post-layout .has-img input[type=radio]{clip:rect(1px,1px,1px,1px);height:1px;overflow:hidden;position:absolute!important;width:1px}#hybrid-post-layout img{box-sizing:border-box;max-width:100%;height:auto;padding:1px;border:4px solid transparent}#hybrid-post-layout img:hover,#hybrid-post-layout img:focus{border-color:#ddd}#hybrid-post-layout input:checked+span+img{border-color:#00a0d2}
View
58 css/customize-controls.css
@@ -0,0 +1,58 @@
+/**
+ * Customize Controls Stylesheet
+ * @version 20150507
+ */
+
+/* === Palette Control === */
+
+.customize-control-palette label {
+ display: block;
+ padding: 0 10px 10px;
+}
+
+.customize-control-palette label.selected {
+ padding-top: 5px;
+ background-color: #ddd;
+}
+
+ .customize-control-palette .palette-label {
+ line-height: 28px;
+ }
+
+ .customize-control-palette .palette-block {
+ display: table;
+ width: 100%;
+ height: 45px;
+ }
+
+ .customize-control-palette .palette-color {
+ display: table-cell;
+ height: 100%;
+ }
+
+/* === Radio Image Control === */
+
+.customize-control-radio-image input[type="radio"] {
+ clip: rect(1px, 1px, 1px, 1px);
+ height: 1px;
+ overflow: hidden;
+ position: absolute !important;
+ width: 1px;
+}
+
+.customize-control-radio-image img {
+ box-sizing: border-box;
+ max-width: 100%;
+ height: auto;
+ padding: 1px;
+ border: 4px solid transparent;
+}
+
+ .customize-control-radio-image img:hover,
+ .customize-control-radio-image img:focus {
+ border-color: #ccc;
+ }
+
+ .customize-control-radio-image input:checked + span + img {
+ border-color: #00a0d2;
+ }
View
1  css/customize-controls.min.css
@@ -0,0 +1 @@
+.customize-control-palette label{display:block;padding:0 10px 10px}.customize-control-palette label.selected{padding-top:5px;background-color:#ddd}.customize-control-palette .palette-label{line-height:28px}.customize-control-palette .palette-block{display:table;width:100%;height:45px}.customize-control-palette .palette-color{display:table-cell;height:100%}.customize-control-radio-image input[type=radio]{clip:rect(1px,1px,1px,1px);height:1px;overflow:hidden;position:absolute!important;width:1px}.customize-control-radio-image img{box-sizing:border-box;max-width:100%;height:auto;padding:1px;border:4px solid transparent}.customize-control-radio-image img:hover,.customize-control-radio-image img:focus{border-color:#ccc}.customize-control-radio-image input:checked+span+img{border-color:#00a0d2}
View
242 css/gallery.css
@@ -1,88 +1,204 @@
/**
* Cleaner Gallery Stylesheet
- * @version 20130526
+ * @version 20150615
*/
.gallery {
- display: block;
- clear: both;
- overflow: hidden;
- margin: 0 auto;
+ max-width: 100%;
+ display: block;
+ clear: both;
+ margin: 0 auto 20px;
}
- .gallery-row {
- display: block;
- clear: both;
- overflow: hidden;
- margin: 0;
+ .gallery::after {
+ content: ".";
+ display: block;
+ height: 0;
+ clear: both;
+ visibility: hidden;
}
.gallery-item {
- overflow: hidden;
- float: left;
- margin: 0;
+ width: 100%;
padding: 0;
text-align: center;
list-style: none;
border: none;
background: transparent;
-
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
+ box-sizing: border-box;
}
.gallery-icon {}
.gallery-icon img {
- width: auto;
- max-width: 89%;
- height: auto;
- margin: 0 auto;
- padding: 1%;
-
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
+ width: auto;
+ max-width: 100%;
+ height: auto;
+ margin: 0 auto;
+ box-sizing: border-box;
}
- .gallery-caption {
- margin-left: 0;
+ .gallery-type-circle img {
+ border-radius: 50%;
+ }
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
+ .gallery-caption {
+ margin: 5px 0 0;
+ box-sizing: border-box;
}
-/* Gallery item sizes depending on the number of columns */
-.gallery-col-0 .gallery-item { width: 100%; }
-.gallery-col-1 .gallery-item { width: 100%; }
-.gallery-col-2 .gallery-item { width: 50%; }
-.gallery-col-3 .gallery-item { width: 33.33%; }
-.gallery-col-4 .gallery-item { width: 25%; }
-.gallery-col-5 .gallery-item { width: 20%; }
-.gallery-col-6 .gallery-item { width: 16.66%; }
-.gallery-col-7 .gallery-item { width: 14.28%; }
-.gallery-col-8 .gallery-item { width: 12.5%; }
-.gallery-col-9 .gallery-item { width: 11.11%; }
-.gallery-col-10 .gallery-item { width: 10%; }
-.gallery-col-11 .gallery-item { width: 9.09%; }
-.gallery-col-12 .gallery-item { width: 8.33%; }
-.gallery-col-13 .gallery-item { width: 7.69%; }
-.gallery-col-14 .gallery-item { width: 7.14%; }
-.gallery-col-15 .gallery-item { width: 6.66%; }
-.gallery-col-16 .gallery-item { width: 6.25%; }
-.gallery-col-17 .gallery-item { width: 5.88%; }
-.gallery-col-18 .gallery-item { width: 5.55%; }
-.gallery-col-19 .gallery-item { width: 5.26%; }
-.gallery-col-20 .gallery-item { width: 5%; }
-.gallery-col-21 .gallery-item { width: 4.76%; }
-.gallery-col-22 .gallery-item { width: 4.54%; }
-.gallery-col-23 .gallery-item { width: 4.34%; }
-.gallery-col-24 .gallery-item { width: 4.16%; }
-.gallery-col-25 .gallery-item { width: 4%; }
-.gallery-col-26 .gallery-item { width: 3.84%; }
-.gallery-col-27 .gallery-item { width: 3.7%; }
-.gallery-col-28 .gallery-item { width: 3.57%; }
-.gallery-col-29 .gallery-item { width: 3.44%; }
-.gallery-col-30 .gallery-item { width: 3.33%; }
+/* When the screen width is at least 480px. */
+@media only screen and ( min-width: 480px ) {
+
+ .gallery-item {
+ float: left;
+ margin: 0 5% 5px 0;
+ }
+
+ .rtl .gallery-item {
+ float: right;
+ margin-left: 5%;
+ margin-right: 0;
+ }
+
+ /* Everything should be 2 columns. */
+ .gallery-col-2 .gallery-item,
+ .gallery-col-3 .gallery-item,
+ .gallery-col-4 .gallery-item,
+ .gallery-col-5 .gallery-item,
+ .gallery-col-6 .gallery-item,
+ .gallery-col-7 .gallery-item,
+ .gallery-col-8 .gallery-item,
+ .gallery-col-9 .gallery-item,
+ .gallery-col-10 .gallery-item { width: 45%; }
+}
+
+/* When the screen width is between 480px and 539px. */
+@media only screen and ( min-width: 480px ) and ( max-width: 539px ) {
+
+ .gallery-item:nth-of-type( 2n + 1 ) { clear: both; }
+
+ .gallery-item:nth-child( 2n ) { margin-right: 0; float: right; }
+ .rtl .gallery-item:nth-child( 2n ) { margin-left: 0; float: left; }
+}
+
+/* When the screen width is between 540px and 639px. */
+@media only screen and ( min-width: 540px ) and ( max-width: 639px ) {
+
+ .gallery-col-3 .gallery-item:nth-child( 3n + 1 ),
+ .gallery-col-4 .gallery-item:nth-child( 3n + 1 ),
+ .gallery-col-5 .gallery-item:nth-child( 3n + 1 ),
+ .gallery-col-6 .gallery-item:nth-child( 3n + 1 ),
+ .gallery-col-7 .gallery-item:nth-child( 3n + 1 ),
+ .gallery-col-8 .gallery-item:nth-child( 3n + 1 ),
+ .gallery-col-9 .gallery-item:nth-child( 3n + 1 ),
+ .gallery-col-10 .gallery-item:nth-child( 3n + 1 ) { clear: both; }
+
+ .gallery-col-3 .gallery-item:nth-child( 3n ),
+ .gallery-col-4 .gallery-item:nth-child( 3n ),
+ .gallery-col-5 .gallery-item:nth-child( 3n ),
+ .gallery-col-6 .gallery-item:nth-child( 3n ),
+ .gallery-col-7 .gallery-item:nth-child( 3n ),
+ .gallery-col-8 .gallery-item:nth-child( 3n ),
+ .gallery-col-9 .gallery-item:nth-child( 3n ),
+ .gallery-col-10 .gallery-item:nth-child( 3n ) { float: right; margin-left: 0; margin-right: 0; }
+
+ .rtl .gallery-col-3 .gallery-item:nth-child( 3n ),
+ .rtl .gallery-col-4 .gallery-item:nth-child( 3n ),
+ .rtl .gallery-col-5 .gallery-item:nth-child( 3n ),
+ .rtl .gallery-col-6 .gallery-item:nth-child( 3n ),
+ .rtl .gallery-col-7 .gallery-item:nth-child( 3n ),
+ .rtl .gallery-col-8 .gallery-item:nth-child( 3n ),
+ .rtl .gallery-col-9 .gallery-item:nth-child( 3n ),
+ .rtl .gallery-col-10 .gallery-item:nth-child( 3n ) { float: left; }
+
+ /* Handle the columns. */
+ .gallery-col-3 .gallery-item,
+ .gallery-col-4 .gallery-item,
+ .gallery-col-5 .gallery-item,
+ .gallery-col-6 .gallery-item,
+ .gallery-col-7 .gallery-item,
+ .gallery-col-8 .gallery-item,
+ .gallery-col-9 .gallery-item,
+ .gallery-col-10 .gallery-item { width: 30%; }
+}
+
+/* When the screen width is between 640px and 767px. */
+@media only screen and ( min-width: 640px ) and ( max-width: 767px ) {
+
+ .gallery-col-2 .gallery-item:nth-child( 2n + 1 ),
+ .gallery-col-3 .gallery-item:nth-child( 3n + 1 ),
+ .gallery-col-4 .gallery-item:nth-child( 4n + 1 ),
+ .gallery-col-5 .gallery-item:nth-child( 4n + 1 ),
+ .gallery-col-6 .gallery-item:nth-child( 4n + 1 ),
+ .gallery-col-7 .gallery-item:nth-child( 4n + 1 ),
+ .gallery-col-8 .gallery-item:nth-child( 4n + 1 ),
+ .gallery-col-9 .gallery-item:nth-child( 4n + 1 ),
+ .gallery-col-10 .gallery-item:nth-child( 4n + 1 ) { clear: both; }
+
+ .gallery-col-2 .gallery-item:nth-child( 2n ),
+ .gallery-col-3 .gallery-item:nth-child( 3n ),
+ .gallery-col-4 .gallery-item:nth-child( 4n ),
+ .gallery-col-5 .gallery-item:nth-child( 4n ),
+ .gallery-col-6 .gallery-item:nth-child( 4n ),
+ .gallery-col-7 .gallery-item:nth-child( 4n ),
+ .gallery-col-8 .gallery-item:nth-child( 4n ),
+ .gallery-col-9 .gallery-item:nth-child( 4n ),
+ .gallery-col-10 .gallery-item:nth-child( 4n ) { float: right; margin-left: 0; margin-right: 0; }
+
+ .rtl .gallery-col-2 .gallery-item:nth-child( 2n ),
+ .rtl .gallery-col-3 .gallery-item:nth-child( 3n ),
+ .rtl .gallery-col-4 .gallery-item:nth-child( 4n ),
+ .rtl .gallery-col-5 .gallery-item:nth-child( 4n ),
+ .rtl .gallery-col-6 .gallery-item:nth-child( 4n ),
+ .rtl .gallery-col-7 .gallery-item:nth-child( 4n ),
+ .rtl .gallery-col-8 .gallery-item:nth-child( 4n ),
+ .rtl .gallery-col-9 .gallery-item:nth-child( 4n ),
+ .rtl .gallery-col-10 .gallery-item:nth-child( 4n ) { float: left; }
+
+ /* Handle the columns. */
+ .gallery-col-2 .gallery-item { width: 45%; }
+ .gallery-col-3 .gallery-item { width: 30%; }
+ .gallery-col-4 .gallery-item,
+ .gallery-col-5 .gallery-item,
+ .gallery-col-6 .gallery-item,
+ .gallery-col-7 .gallery-item,
+ .gallery-col-8 .gallery-item,
+ .gallery-col-9 .gallery-item,
+ .gallery-col-10 .gallery-item { width: 21.25%; }
+}
+
+/* When the screen width is at least 768px. */
+@media only screen and ( min-width: 768px ) {
+
+ .gallery-col-2 .gallery-item:nth-child( 2n + 1 ),
+ .gallery-col-3 .gallery-item:nth-child( 3n + 1 ),
+ .gallery-col-4 .gallery-item:nth-child( 4n + 1 ),
+ .gallery-col-5 .gallery-item:nth-child( 5n + 1 ),
+ .gallery-col-6 .gallery-item:nth-child( 6n + 1 ),
+ .gallery-col-7 .gallery-item:nth-child( 7n + 1 ),
+ .gallery-col-8 .gallery-item:nth-child( 8n + 1 ),
+ .gallery-col-9 .gallery-item:nth-child( 9n + 1 ),
+ .gallery-col-10 .gallery-item:nth-child( 10n + 1 ) { clear: both; }
+
+ .gallery-col-2 .gallery-item:nth-child( 2n ),
+ .gallery-col-3 .gallery-item:nth-child( 3n ),
+ .gallery-col-4 .gallery-item:nth-child( 4n ),
+ .gallery-col-5 .gallery-item:nth-child( 5n ),
+ .gallery-col-6 .gallery-item:nth-child( 6n ),
+ .gallery-col-7 .gallery-item:nth-child( 7n ),
+ .gallery-col-8 .gallery-item:nth-child( 8n ),
+ .gallery-col-9 .gallery-item:nth-child( 9n ),
+ .gallery-col-10 .gallery-item:nth-child( 10n ) { margin-left: 0; margin-right: 0; }
+
+ /* Handle the columns. */
+ .gallery-col-2 .gallery-item { width: 45%; }
+ .gallery-col-3 .gallery-item { width: 30%; }
+ .gallery-col-4 .gallery-item { width: 21.25%; }
+ .gallery-col-5 .gallery-item { width: 16%; }
+ .gallery-col-6 .gallery-item { width: 12.5%; }
+ .gallery-col-7 .gallery-item { width: 10%; }
+ .gallery-col-8 .gallery-item { width: 8.125%; }
+ .gallery-col-9 .gallery-item { width: 6.66%; }
+ .gallery-col-10 .gallery-item { width: 5.5%; }
+}
View
2  css/gallery.min.css
@@ -1 +1 @@
-.gallery{display: block;clear: both;overflow:hidden;margin: 0 auto}.gallery-row{display: block;clear: both;overflow:hidden;margin: 0}.gallery-item{overflow: hidden;float: left;margin: 0;padding: 0;text-align:center;list-style:none;border: none;background:transparent;-webkit-box-sizing:border-box;-moz-box-sizing: border-box;box-sizing: border-box}.gallery-icon{}.gallery-icon img{width: auto;max-width:89%;height: auto;margin: 0 auto;padding: 1%;-webkit-box-sizing:border-box;-moz-box-sizing: border-box;box-sizing: border-box}.gallery-caption{margin-left:0;-webkit-box-sizing:border-box;-moz-box-sizing: border-box;box-sizing: border-box}.gallery-col-0 .gallery-item {width:100%}.gallery-col-1 .gallery-item {width:100%}.gallery-col-2 .gallery-item {width:50%}.gallery-col-3 .gallery-item {width:33.33%}.gallery-col-4 .gallery-item {width:25%}.gallery-col-5 .gallery-item {width:20%}.gallery-col-6 .gallery-item {width:16.66%}.gallery-col-7 .gallery-item {width:14.28%}.gallery-col-8 .gallery-item {width:12.5%}.gallery-col-9 .gallery-item {width:11.11%}.gallery-col-10 .gallery-item{width:10%}.gallery-col-11 .gallery-item{width:9.09%}.gallery-col-12 .gallery-item{width:8.33%}.gallery-col-13 .gallery-item{width:7.69%}.gallery-col-14 .gallery-item{width:7.14%}.gallery-col-15 .gallery-item{width:6.66%}.gallery-col-16 .gallery-item{width:6.25%}.gallery-col-17 .gallery-item{width:5.88%}.gallery-col-18 .gallery-item{width:5.55%}.gallery-col-19 .gallery-item{width:5.26%}.gallery-col-20 .gallery-item{width:5%}.gallery-col-21 .gallery-item{width:4.76%}.gallery-col-22 .gallery-item{width:4.54%}.gallery-col-23 .gallery-item{width:4.34%}.gallery-col-24 .gallery-item{width:4.16%}.gallery-col-25 .gallery-item{width:4%}.gallery-col-26 .gallery-item{width:3.84%}.gallery-col-27 .gallery-item{width:3.7%}.gallery-col-28 .gallery-item{width:3.57%}.gallery-col-29 .gallery-item{width:3.44%}.gallery-col-30 .gallery-item{width:3.33%}
+.gallery{max-width:100%;display:block;clear:both;margin:0 auto 20px}.gallery::after{content:".";display:block;height:0;clear:both;visibility:hidden}.gallery-item{width:100%;padding:0;text-align:center;list-style:none;border:0;background:transparent;box-sizing:border-box}.gallery-icon img{width:auto;max-width:100%;height:auto;margin:0 auto;box-sizing:border-box}.gallery-type-circle img{border-radius:50%}.gallery-caption{margin:5px 0 0;box-sizing:border-box}@media only screen and (min-width:480px){.gallery-item{float:left;margin:0 5% 5px 0}.rtl .gallery-item{float:right;margin-left:5%;margin-right:0}.gallery-col-2 .gallery-item,.gallery-col-3 .gallery-item,.gallery-col-4 .gallery-item,.gallery-col-5 .gallery-item,.gallery-col-6 .gallery-item,.gallery-col-7 .gallery-item,.gallery-col-8 .gallery-item,.gallery-col-9 .gallery-item,.gallery-col-10 .gallery-item{width:45%}}@media only screen and (min-width:480px) and (max-width:539px){.gallery-item:nth-of-type(2n+1){clear:both}.gallery-item:nth-child(2n){margin-right:0;float:right}.rtl .gallery-item:nth-child(2n){margin-left:0;float:left}}@media only screen and (min-width:540px) and (max-width:639px){.gallery-col-3 .gallery-item:nth-child(3n+1),.gallery-col-4 .gallery-item:nth-child(3n+1),.gallery-col-5 .gallery-item:nth-child(3n+1),.gallery-col-6 .gallery-item:nth-child(3n+1),.gallery-col-7 .gallery-item:nth-child(3n+1),.gallery-col-8 .gallery-item:nth-child(3n+1),.gallery-col-9 .gallery-item:nth-child(3n+1),.gallery-col-10 .gallery-item:nth-child(3n+1){clear:both}.gallery-col-3 .gallery-item:nth-child(3n),.gallery-col-4 .gallery-item:nth-child(3n),.gallery-col-5 .gallery-item:nth-child(3n),.gallery-col-6 .gallery-item:nth-child(3n),.gallery-col-7 .gallery-item:nth-child(3n),.gallery-col-8 .gallery-item:nth-child(3n),.gallery-col-9 .gallery-item:nth-child(3n),.gallery-col-10 .gallery-item:nth-child(3n){float:right;margin-left:0;margin-right:0}.rtl .gallery-col-3 .gallery-item:nth-child(3n),.rtl .gallery-col-4 .gallery-item:nth-child(3n),.rtl .gallery-col-5 .gallery-item:nth-child(3n),.rtl .gallery-col-6 .gallery-item:nth-child(3n),.rtl .gallery-col-7 .gallery-item:nth-child(3n),.rtl .gallery-col-8 .gallery-item:nth-child(3n),.rtl .gallery-col-9 .gallery-item:nth-child(3n),.rtl .gallery-col-10 .gallery-item:nth-child(3n){float:left}.gallery-col-3 .gallery-item,.gallery-col-4 .gallery-item,.gallery-col-5 .gallery-item,.gallery-col-6 .gallery-item,.gallery-col-7 .gallery-item,.gallery-col-8 .gallery-item,.gallery-col-9 .gallery-item,.gallery-col-10 .gallery-item{width:30%}}@media only screen and (min-width:640px) and (max-width:767px){.gallery-col-2 .gallery-item:nth-child(2n+1),.gallery-col-3 .gallery-item:nth-child(3n+1),.gallery-col-4 .gallery-item:nth-child(4n+1),.gallery-col-5 .gallery-item:nth-child(4n+1),.gallery-col-6 .gallery-item:nth-child(4n+1),.gallery-col-7 .gallery-item:nth-child(4n+1),.gallery-col-8 .gallery-item:nth-child(4n+1),.gallery-col-9 .gallery-item:nth-child(4n+1),.gallery-col-10 .gallery-item:nth-child(4n+1){clear:both}.gallery-col-2 .gallery-item:nth-child(2n),.gallery-col-3 .gallery-item:nth-child(3n),.gallery-col-4 .gallery-item:nth-child(4n),.gallery-col-5 .gallery-item:nth-child(4n),.gallery-col-6 .gallery-item:nth-child(4n),.gallery-col-7 .gallery-item:nth-child(4n),.gallery-col-8 .gallery-item:nth-child(4n),.gallery-col-9 .gallery-item:nth-child(4n),.gallery-col-10 .gallery-item:nth-child(4n){float:right;margin-left:0;margin-right:0}.rtl .gallery-col-2 .gallery-item:nth-child(2n),.rtl .gallery-col-3 .gallery-item:nth-child(3n),.rtl .gallery-col-4 .gallery-item:nth-child(4n),.rtl .gallery-col-5 .gallery-item:nth-child(4n),.rtl .gallery-col-6 .gallery-item:nth-child(4n),.rtl .gallery-col-7 .gallery-item:nth-child(4n),.rtl .gallery-col-8 .gallery-item:nth-child(4n),.rtl .gallery-col-9 .gallery-item:nth-child(4n),.rtl .gallery-col-10 .gallery-item:nth-child(4n){float:left}.gallery-col-2 .gallery-item{width:45%}.gallery-col-3 .gallery-item{width:30%}.gallery-col-4 .gallery-item,.gallery-col-5 .gallery-item,.gallery-col-6 .gallery-item,.gallery-col-7 .gallery-item,.gallery-col-8 .gallery-item,.gallery-col-9 .gallery-item,.gallery-col-10 .gallery-item{width:21.25%}}@media only screen and (min-width:768px){.gallery-col-2 .gallery-item:nth-child(2n+1),.gallery-col-3 .gallery-item:nth-child(3n+1),.gallery-col-4 .gallery-item:nth-child(4n+1),.gallery-col-5 .gallery-item:nth-child(5n+1),.gallery-col-6 .gallery-item:nth-child(6n+1),.gallery-col-7 .gallery-item:nth-child(7n+1),.gallery-col-8 .gallery-item:nth-child(8n+1),.gallery-col-9 .gallery-item:nth-child(9n+1),.gallery-col-10 .gallery-item:nth-child(10n+1){clear:both}.gallery-col-2 .gallery-item:nth-child(2n),.gallery-col-3 .gallery-item:nth-child(3n),.gallery-col-4 .gallery-item:nth-child(4n),.gallery-col-5 .gallery-item:nth-child(5n),.gallery-col-6 .gallery-item:nth-child(6n),.gallery-col-7 .gallery-item:nth-child(7n),.gallery-col-8 .gallery-item:nth-child(8n),.gallery-col-9 .gallery-item:nth-child(9n),.gallery-col-10 .gallery-item:nth-child(10n){margin-left:0;margin-right:0}.gallery-col-2 .gallery-item{width:45%}.gallery-col-3 .gallery-item{width:30%}.gallery-col-4 .gallery-item{width:21.25%}.gallery-col-5 .gallery-item{width:16%}.gallery-col-6 .gallery-item{width:12.5%}.gallery-col-7 .gallery-item{width:10%}.gallery-col-8 .gallery-item{width:8.125%}.gallery-col-9 .gallery-item{width:6.66%}.gallery-col-10 .gallery-item{width