Add alx_ext_sharrre_footer action and template, add sharrre-header css class for compatibility

This commit is contained in:
Alexander Agnarson 2019-01-14 22:09:17 +01:00
parent a2dbb282ed
commit 3b677f0df8
5 changed files with 78 additions and 9 deletions

View file

@ -19,6 +19,7 @@ define( 'ALX_EXTENSIONS_URL', rtrim( plugin_dir_url( __FILE__ ), '/' ) );
require_once ALX_EXTENSIONS_DIR . '/inc/options.php';
require_once ALX_EXTENSIONS_DIR . '/inc/share.php';
require_once ALX_EXTENSIONS_DIR . '/inc/share-footer.php';
require_once ALX_EXTENSIONS_DIR . '/inc/post-formats.php';
/* load plugin textdomain */

54
inc/share-footer.php Normal file
View file

@ -0,0 +1,54 @@
<?php
/* load template */
function alx_ext_sharrre_footer_actions() {
add_action( 'alx_ext_sharrre_footer', 'alx_ext_sharrre_footer_template' );
}
add_action( 'plugins_loaded', 'alx_ext_sharrre_footer_actions' );
/* template */
function alx_ext_sharrre_footer_template() {
$enable_social_share = get_theme_mod( 'enable-social-share', true );
if ( true !== $enable_social_share ) {
return;
}
?>
<div class="sharrre-footer group">
<div id="facebook-footer" data-url="<?php echo the_permalink(); ?>" data-text="<?php echo the_title(); ?>" data-title="<?php esc_attr_e('Share', 'alx-extensions'); ?>"></div>
<div id="twitter-footer" data-url="<?php echo the_permalink(); ?>" data-text="<?php echo the_title(); ?>" data-title="<?php esc_attr_e('Share', 'alx-extensions'); ?>"></div>
</div><!--/.sharrre-footer-->
<script type="text/javascript">
// Sharrre
jQuery(document).ready(function(){
jQuery('#twitter-footer').sharrre({
share: {
twitter: true
},
template: '<a class="box group" href="#"><div class="share"><i class="fa fa-twitter"></i><?php esc_html_e('Share', 'alx-extensions'); ?> <span><?php esc_html_e('on Twitter', 'alx-extensions'); ?></span><div class="count" href="#"><i class="fa fa-plus"></i></div></div></a>',
enableHover: false,
enableTracking: true,
buttons: { twitter: {via: '<?php echo esc_attr( get_theme_mod('twitter-username') ); ?>'}},
click: function(api, options){
api.simulateClick();
api.openPopup('twitter');
}
});
jQuery('#facebook-footer').sharrre({
share: {
facebook: true
},
template: '<a class="box group" href="#"><div class="share"><i class="fa fa-facebook-square"></i><?php esc_html_e('Share', 'alx-extensions'); ?> <span><?php esc_html_e('on Facebook', 'alx-extensions'); ?></span><div class="count" href="#">{total}</div></div></a>',
enableHover: false,
enableTracking: true,
buttons:{layout: 'box_count'},
click: function(api, options){
api.simulateClick();
api.openPopup('facebook');
}
});
});
</script>
<?php
}

View file

@ -14,7 +14,7 @@ function alx_ext_sharrre_template() {
}
?>
<div class="sharrre-container group">
<div class="sharrre-container sharrre-header group">
<span><?php esc_html_e('Share','alx-extensions'); ?></span>
<div id="twitter" data-url="<?php the_permalink(); ?>" data-text="<?php echo the_title_attribute(); ?>" data-title="<?php esc_attr_e('Tweet', 'alx-extensions'); ?>"></div>
<div id="facebook" data-url="<?php the_permalink(); ?>" data-text="<?php echo the_title_attribute(); ?>" data-title="<?php esc_attr_e('Like', 'alx-extensions'); ?>"></div>

View file

@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: Alx Extensions\n"
"POT-Creation-Date: 2018-09-22 13:25+0200\n"
"POT-Creation-Date: 2019-01-14 22:02+0100\n"
"PO-Revision-Date: 2018-09-21 21:27+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -10,7 +10,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.1.1\n"
"X-Generator: Poedit 2.2\n"
"X-Poedit-KeywordsList: __;_e;_x;_ex;_n;_nx;_n_noop;_nx_noop;"
"translate_nooped_plural;number_format_i18n;date_i18n;esc_html__;esc_html_e;"
"esc_html_x;esc_attr__;esc_attr_e;esc_attr_x\n"
@ -99,10 +99,19 @@ msgstr ""
msgid "Video URL"
msgstr ""
#: inc/share.php:18
#: inc/share-footer.php:18 inc/share-footer.php:19 inc/share-footer.php:29
#: inc/share-footer.php:42 inc/share.php:18
msgid "Share"
msgstr ""
#: inc/share-footer.php:29
msgid "on Twitter"
msgstr ""
#: inc/share-footer.php:42
msgid "on Facebook"
msgstr ""
#: inc/share.php:19
msgid "Tweet"
msgstr ""

View file

@ -2,20 +2,25 @@
Contributors: alxmedia
Tags:
Requires at least: 4.9
Tested up to: 4.9
Stable tag: 1.0.3
Requires at least: 5.0
Tested up to: 5.0
Stable tag: 1.0.5
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
Extends free AlxMedia themes with additional features such as social share links, custom sidebars, thumbnail image upscale and post format meta boxes.
Extends AlxMedia themes with additional features such as social share links, custom sidebars, thumbnail image upscale and post format meta boxes.
== Description ==
Extends free AlxMedia themes with additional features such as social share links, custom sidebars, thumbnail image upscale and post format meta boxes.
Extends AlxMedia themes with additional features such as social share links, custom sidebars, thumbnail image upscale and post format meta boxes.
== Changelog ==
= 1.0.5 - 2019-01-14 =
* Update .pot language file
* Add alx_ext_sharrre_footer action and template
* Add sharrre-header css class for compatibility
= 1.0.4 - 2018-09-24 =
* Update .pot language file