Skip to content
This repository has been archived by the owner on Feb 7, 2021. It is now read-only.

Commit

Permalink
Merge branch 'master' into 1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
rogertm committed Jul 13, 2018
2 parents b485cf3 + a4ca866 commit b8ed54c
Show file tree
Hide file tree
Showing 14 changed files with 157 additions and 102 deletions.
8 changes: 8 additions & 0 deletions changelog.txt
@@ -1,5 +1,13 @@
== Changelog ==

= 1.3.2 =
Release Date: July 12, 2018
* Update: Data Base version 20180712
* Update: WordPress version 4.9.6
* Enhancement: New options 'excerpt_thumbnail_columns'
* Fix Bug: Eliminate Media Object markup in archives (thumbnail left and right)
* Fix Bug: Eliminate first uploaded image from t_em_featured_post_thumbnail() in favor of featured post thumbnail

= 1.3.1 =
Release Date: May 16, 2018
* Update: Data Base version 20180515
Expand Down
3 changes: 3 additions & 0 deletions css/theme.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion css/theme.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion css/theme.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion css/theme.min.css.map

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions engine/archive-options.php
Expand Up @@ -196,6 +196,11 @@ function t_em_excerpt_callback(){
$extend_excerpt .= '</div>';
endforeach;
$extend_excerpt .= '</div><!-- .sub-extend -->';
$extend_excerpt .= '<div class="sub-extend option-group">';
$extend_excerpt .= '<header>'. __( 'Thumbnail column width', 't_em' ) .'</header>';
$extend_excerpt .= '<p>'. __( 'Should be a number between <code>2</code> and <code>6</code>. Default to <code>3</code>.', 't_em' ) .'</p>';
$extend_excerpt .= '<input type="number" name="t_em_theme_options[excerpt_thumbnail_columns]" value="'. t_em( 'excerpt_thumbnail_columns' ) .'" min="2" max="6">';
$extend_excerpt .= '</div><!-- .sub-extend -->';

$extend_excerpt .= '<div class="sub-extend layout text-radio-option-group option-group">';
$extend_excerpt .= '<header>'. __( 'Columns', 't_em' ) .'</header>';
Expand Down
2 changes: 1 addition & 1 deletion engine/constants.php
Expand Up @@ -21,7 +21,7 @@
define ( 'T_EM_SITE', 'https://themingisprose.com/twenty-em' );
define ( 'T_EM_BLOG', 'https://themingisprose.com/twenty-em/blog' );
define ( 'T_EM_WIKI', 'https://themingisprose.com/twenty-em/documentacion' );
define ( 'T_EM_ICON_PACK', 'https://themingisprose.com/twenty-em/icon-pack' );
define ( 'T_EM_ICON_PACK', 'https://themingisprose.com/icon-pack' );
define ( 'T_EM_PAYPAL', 'https://paypal.me/themingisprose' );

// WordPress version in which Twenty'em has been tested
Expand Down
12 changes: 12 additions & 0 deletions engine/functions.php
Expand Up @@ -190,6 +190,7 @@ function t_em_default_theme_options( $default_theme_options = '' ){
'excerpt_set' => 'thumbnail-left',
'excerpt_thumbnail_width' => get_option( 'thumbnail_size_w' ),
'excerpt_thumbnail_height' => get_option( 'thumbnail_size_h' ),
'excerpt_thumbnail_columns' => '3',
'archive_in_columns' => '1',
'archive_pagination_set' => 'prev-next',
// Layout Options
Expand Down Expand Up @@ -397,6 +398,16 @@ function t_em_theme_options_validate( $input ){
$input['excerpt_thumbnail_height'] = $input['excerpt_thumbnail_height'];
endif;

// Excerpt Thumbnail Columns: Default: 3, max: 6, min: 2.
if ( empty( $input['excerpt_thumbnail_columns'] )
|| ! is_numeric( $input['excerpt_thumbnail_columns'] )
|| $input['excerpt_thumbnail_columns'] < 2
|| $input['excerpt_thumbnail_columns'] > 6 ) :
$input['excerpt_thumbnail_columns'] = '3';
else :
$input['excerpt_thumbnail_columns'] = $input['excerpt_thumbnail_columns'];
endif;

// Bootstrap Carousel Interval: default: 5000, max: 10000, min: 1000.
if ( ( $input['bootstrap_carousel_interval'] < T_EM_BOOTSTRAP_CAROUSEL_INTERVAL_MIN_VALUE || $input['bootstrap_carousel_interval'] > T_EM_BOOTSTRAP_CAROUSEL_INTERVAL_MAX_VALUE ) || empty( $input['bootstrap_carousel_interval'] ) || ! is_numeric( $input['bootstrap_carousel_interval'] ) ) :
$input['bootstrap_carousel_interval'] = T_EM_BOOTSTRAP_CAROUSEL_INTERVAL_DEFAULT_VALUE;
Expand All @@ -410,6 +421,7 @@ function t_em_theme_options_validate( $input ){
'bootstrap_carousel_interval',
'excerpt_thumbnail_width',
'excerpt_thumbnail_height',
'excerpt_thumbnail_columns',
) as $int ) :
$input[$int] = wp_filter_nohtml_kses( $input[$int] );
endforeach;
Expand Down
112 changes: 51 additions & 61 deletions inc/functions.php
Expand Up @@ -269,15 +269,27 @@ function t_em_container( $echo = true ){
*
* @since Twenty'em 1.0
* @since Twenty'em 1.2 Deleted "figure" and "figcaption" wrapped element
* @since Twenty'em 1.3.2 Show only the featured post thumbnail if exists
*/
function t_em_featured_post_thumbnail( $width, $height, $link = true, $class = null, $post_id = 0 ){
$post_id = absint( $post_id );
if ( ! $post_id )
$post_id = get_the_ID();

$attachment_id = get_post_thumbnail_id( $post_id );

$open_link = ( $link ) ? '<a href="'. get_permalink( $post_id ) .'" rel="bookmark">' : null;
$close_link = ( $link ) ? '</a>' : null;
$thumbnail = t_em_image_resize( $width, $height, $post_id );

/**
* Filter default image to show if the current post has no image associated to it
* @param null $default_post_thumbnail. URL of the default post thumbnail
*
* @since Twenty'em 1.0
*/
$default_thumbnail = apply_filters( 't_em_filter_default_post_thumbnail', null );

$thumbnail = ( t_em_image_resize( $width, $height, $attachment_id ) ) ? t_em_image_resize( $width, $height, $attachment_id ) : $default_thumbnail;

if ( $thumbnail ) :
echo $open_link; ?>
Expand All @@ -289,72 +301,50 @@ function t_em_featured_post_thumbnail( $width, $height, $link = true, $class = n
/**
* Resize images on the fly
*
* @param int $width Required. New image width
* @param int $height Required. New image height
* @param int $post_id Optional. Current Post ID. Default is ID of the global $post.
* @param bool $crop Optional. Crop image. Default true
* @param int $width Required. New image width
* @param int $height Required. New image height
* @param int $attachment_id Required. Attachment ID
* @param bool $crop Optional. Crop image. Default true
*
* @return string|null URL of the new image if the current post ($post_id) has a post thumbnail or
* any image associate to it, Or null if there are no images associated to the
* current post.
* @return string|null URL of the new image.
*
* @since Twenty'em 1.0
* @since Twenty'em 1.3.2 Change parameter $post_id to $attachment_id
*/
function t_em_image_resize( $width, $height, $post_id = 0, $crop = true ){
$post_id = absint( $post_id );
if ( ! $post_id )
$post_id = get_the_ID();
function t_em_image_resize( $width, $height, $attachment_id, $crop = true ){
$image_path = get_attached_file( $attachment_id );

if ( ! $image_path )
return;

// Image data
$image_url = wp_get_attachment_image_src( $attachment_id, 'full' );
$image_src = $image_url[0]; // Original image
$image_edit = wp_get_image_editor( $image_url[0] );
$image_info = pathinfo( $image_path );

if ( has_post_thumbnail( $post_id ) ) :
$image_url = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), 'full' );
$image_path = get_attached_file( get_post_thumbnail_id( $post_id ) );
// Image dimensions
$image_size = getimagesize( $image_path );

// If Width and Height are bigger than original size we use the original image
if ( $width >= $image_size[0] && $height >= $image_size[1] ) :
$image_thumbnail = $image_src;
else :
$images = get_children( array( 'post_parent' => $post_id, 'post_type' => 'attachment', 'order' => 'ASC', 'post_mime_type' => 'image', 'numberposts' => 9999 ) );
$total_images = count( $images );
$image = array_shift( $images );
$image_url = ( ! empty($image) ) ? wp_get_attachment_image_src( $image->ID, 'full' ) : null;
if ( $total_images >= 1 ) :
$image_path = get_attached_file( $image->ID );
else :
$image_path = null;
endif;
endif;
if ( $image_path ) :
// Image data
$image_src = $image_url[0]; // Original image
$image_edit = wp_get_image_editor( $image_url[0] );
$image_info = pathinfo( $image_path );

// Image dimensions
$image_size = getimagesize( $image_path );

// If Width and Height are bigger than original size we use the original image
if ( $width >= $image_size[0] && $height >= $image_size[1] ) :
$image_thumbnail = $image_src;
else :
// Set dimensions
$max_width = ( $width >= $image_size[0] ) ? $image_size[0] : $width;
$max_height = ( $height >= $image_size[1] ) ? $image_size[1] : $height;

// Image to be saved
$image_to_save = $image_info['dirname'] .'/'. $image_info['filename'] .'-'. $max_width .'x'. $max_height .'.'. $image_info['extension'];


// Create the new image
if ( ! file_exists( $image_to_save ) ) :
if ( ! is_wp_error( $image_edit ) ) :
$image_edit->resize( $max_width, $max_height, $crop );
$image_edit->save( $image_to_save );
endif;
// Set dimensions
$max_width = ( $width >= $image_size[0] ) ? $image_size[0] : $width;
$max_height = ( $height >= $image_size[1] ) ? $image_size[1] : $height;

// Image to be saved
$image_to_save = $image_info['dirname'] .'/'. $image_info['filename'] .'-'. $max_width .'x'. $max_height .'.'. $image_info['extension'];

// Create the new image
if ( ! file_exists( $image_to_save ) ) :
if ( ! is_wp_error( $image_edit ) ) :
$image_edit->resize( $max_width, $max_height, $crop );
$image_edit->save( $image_to_save );
endif;
$image_thumbnail = str_replace( $image_info['filename'], $image_info['filename'] .'-'. $max_width .'x'. $max_height, $image_src );
endif;
else :
/**
* Filter default image to show if the current post has no image associated to it
*
* @param null $default_post_thumbnail. URL of the default post thumbnail
* @since Twenty'em 1.0
*/
$image_thumbnail = apply_filters( 't_em_filter_default_post_thumbnail', null );
$image_thumbnail = str_replace( $image_info['filename'], $image_info['filename'] .'-'. $max_width .'x'. $max_height, $image_src );
endif;
return $image_thumbnail;
}
Expand Down
Binary file modified languages/es_ES.mo
Binary file not shown.
32 changes: 22 additions & 10 deletions languages/es_ES.po
Expand Up @@ -4,8 +4,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Twenty'em 1.2.2\n"
"Report-Msgid-Bugs-To: http://wordpress.org/support/theme/twenty-em\n"
"POT-Creation-Date: 2018-05-17 18:26-0400\n"
"PO-Revision-Date: 2018-05-17 18:28-0400\n"
"POT-Creation-Date: 2018-07-12 16:25-0400\n"
"PO-Revision-Date: 2018-07-12 16:26-0400\n"
"Last-Translator: RogerTM <hi@themingisprose.com>\n"
"Language-Team: Theming is Prose <hi@themingisprose.com>\n"
"Language: es_ES\n"
Expand Down Expand Up @@ -134,34 +134,46 @@ msgstr ""
"(<code>%2$s</code> x <code>%3$s</code>) especificadas en las opciones de <a "
"href=\"%1$s\" target=\"_blank\">Ajustes multimedia</a>."

#: engine/archive-options.php:200
msgid "Thumbnail column width"
msgstr "Columnas para la imagen en miniatura"

#: engine/archive-options.php:201
msgid ""
"Should be a number between <code>2</code> and <code>6</code>. Default to "
"<code>3</code>."
msgstr ""
"Debe ser un número entre <code>2</code> y <code>6</code>. Por defecto "
"<code>3</code>."

#: engine/archive-options.php:206
msgid "Columns"
msgstr "Columnas"

#: engine/archive-options.php:202
#: engine/archive-options.php:207
msgid "Break Loop in columns (It may affect the thumbnail size)"
msgstr ""
"Dividir el archivo en columnas (puede afectar las dimensiones de las "
"imágenes en miniaturas)"

#: engine/archive-options.php:230
#: engine/archive-options.php:235
msgid "Display <code>Newer</code> and <code>Older</code> posts links"
msgstr ""
"Mostrar enlaces a entradas <code>Recientes</code> y <code>Antiguas</code>"

#: engine/archive-options.php:234
#: engine/archive-options.php:239
msgid ""
"Display a paginated list of links <code>&laquo; Newer 1 &hellip; 3 4 5 6 7 "
"&hellip; 9 Older &raquo;</code>"
msgstr ""
"Mostrar lista de paginada <code>&laquo; Recientes 1 &hellip; 3 4 5 6 7 "
"&hellip; 9 Antiguas &raquo;</code>"

#: engine/archive-options.php:258
#: engine/archive-options.php:263
msgid "Archive Pagination"
msgstr "Paginado del archivo"

#: engine/archive-options.php:300 engine/front-page-options.php:283
#: engine/archive-options.php:305 engine/front-page-options.php:283
#: engine/header-options.php:374
msgid "<strong>Oops!</strong> No options available for this setting..."
msgstr ""
Expand Down Expand Up @@ -717,11 +729,11 @@ msgstr "Enlace del botón secundario"
msgid "Front Page Template"
msgstr "Plantillas para la Página de Inicio"

#: engine/functions.php:218
#: engine/functions.php:220
msgid "Site in Maintenance"
msgstr "Sitio en Mantenimiento"

#: engine/functions.php:503
#: engine/functions.php:516
msgid "Settings saved. <a href=\"%1$s\">Visit your site</a>."
msgstr "Configuración salvada. <a href=\"%1$s\">Visita tu blog</a>."

Expand Down Expand Up @@ -2248,7 +2260,7 @@ msgstr "Las últimas %1$s entradas"
#: page-templates/template-archive.php:56
#: page-templates/template-blog-content.php:42
#: page-templates/template-sitemap.php:64 template-parts/content-columns.php:26
#: template-parts/content-excerpt.php:26 template-parts/content-full.php:24
#: template-parts/content-excerpt.php:36 template-parts/content-full.php:24
#: template-parts/content-search.php:25 templates/header.php:150
#: templates/meta.php:155
msgid "Permalink to %s"
Expand Down

0 comments on commit b8ed54c

Please sign in to comment.