Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a config path filter to return a 'path' to the Chartbeat configuration #18

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions chartbeat.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Chartbeat
Plugin URI: http://chartbeat.com/wordpress/
Description: Adds Chartbeat pinging to Wordpress.
Version: 2.0.6
Version: 2.0.7
Author: Chartbeat
Author URI: http://chartbeat.com/
*/
Expand Down Expand Up @@ -297,6 +297,9 @@ function chartbeat_configs() {
else
$cb_configs['use_canonical'] = 'false';

// Setup custom 'path'
$cb_configs['path'] = apply_filters( 'chartbeat_config_path', false );

return $cb_configs;

}
Expand All @@ -314,6 +317,9 @@ function add_chartbeat_config(){
_sf_async_config.domain = "<?php echo esc_js($cb_configs["domain"]); ?>";
_sf_async_config.useCanonical = <?php echo esc_js($cb_configs["use_canonical"]); ?>;
<?php
if ( ! empty( $cb_configs['path'] ) ) { ?>
_sf_async_config.path = '<?php echo esc_js( $cb_configs['path'] ); ?>';
<?php }
$enable_newsbeat = get_option('chartbeat_enable_newsbeat');
if ($enable_newsbeat) { ?>
_sf_async_config.authors = "<?php echo esc_js($cb_configs["author"]); ?>";
Expand All @@ -328,7 +334,7 @@ function add_chartbeat_footer() {

// if visitor is admin AND tracking is off, do not load chartbeat
if ( current_user_can( 'manage_options') && get_option('chartbeat_trackadmins') == 0)
return $analytics ;
return;

?>
<script type="text/javascript">
Expand Down
8 changes: 6 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: chartbeat
Tags: chartbeat, analytics, amp, instant articles
Requires at least: 2.8
Tested up to: 4.4.2
Stable tag: 2.0.6
Stable tag: 2.0.7

The Chartbeat plugin automatically adds real-time data and a top pages widget to your blog. See who’s on your site, what they’re doing - right now

Expand Down Expand Up @@ -88,4 +88,8 @@ Nope. Chartbeat code is completely asynchronous, meaning it doesn't begin to run
= 2.0.6 =
* Fix AMP uid bug
* Add admin warning
* Add Facebook Instant Article Support
* Add Facebook Instant Article Support

= 2.0.7 =
* Add 'chartbeat_config_path' filter to return a 'path' to Chartbeat configuration
* Fix return when tracking is off for admin