Ampliado a 280 caracteres el límite para los mensajes de Twitter y nuevo icono para GitHub

This commit is contained in:
Manuel Cillero 2018-04-08 12:31:46 +02:00
parent e90481b6a2
commit 76858efe9c
2 changed files with 374 additions and 355 deletions

View file

@ -110,6 +110,21 @@ function avia_change_tag_page_layout( $layout, $context ) {
return $layout;
}
/*
* Register new icon as a theme icon fot Github.
* See https://kriesi.at/documentation/enfold/custom-social-icons/
*/
add_filter( 'avf_default_icons', 'avia_add_custom_icon', 10, 1 );
function avia_add_custom_icon( $icons ) {
$icons['github'] = array( 'font' =>'fontello', 'icon' => 'uf09b' );
return $icons;
}
add_filter( 'avf_social_icons_options', 'avia_add_custom_social_icon', 10, 1 );
function avia_add_custom_social_icon( $icons ) {
$icons['GitHub'] = 'github';
return $icons;
}
/*
* Add new class in Social, Twitter, Facebook & LinkedIn posts.
* See https://tommcfarlin.com/add-class-to-single-post/
@ -234,7 +249,7 @@ function share_post( $post_id, $post ) {
$post_excerpt .= empty( $text_content ) ? '.' : ". $text_content";
}
$post_excerpt = html_entity_decode( $text_excerpt );
$limit = has_post_thumbnail( $post ) ? 140 - 25 : 140;
$limit = has_post_thumbnail( $post ) ? 280 - 25 : 280;
if ( mb_strlen( $post_excerpt ) > $limit ) {
preg_match_all( '#\bhttps?://[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))#', $post_excerpt, $matches );
for ( $i = 0; $i < count( $matches[0] ); $i++ ) {
@ -336,7 +351,7 @@ jQuery(document).ready(function(){
var tuit_length = excerpt_length;
var urls = jQuery("#excerpt").val().match(urls_regexp);
if (urls) for (i = 0; i < urls.length; i++) tuit_length = tuit_length - urls[i].length + 23;
tuit_length = 140 - tuit_length;
tuit_length = 280 - tuit_length;
return excerpt_length.toString() + " / " + tuit_length.toString() + " (Twitter)";
}
jQuery("#postexcerpt .handlediv").after("<div style=\"position:absolute;top:12px;right:34px;color:#666;\"><span id=\"excerpt_counter\"></span></div>");

View file

@ -634,6 +634,10 @@ a.dpe-flexible-photos-link:hover {
.av-share-box ul li a {
font-size: 18px;
}
#top #wrap_all .av-social-link-github:hover a {
color: #fff;
background-color: #bd2c00;
}
/* Search box adjustment */
#top #s,
#top #searchsubmit {