summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/related-posts/jetpack-related-posts.php')
-rw-r--r--plugins/jetpack/modules/related-posts/jetpack-related-posts.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/plugins/jetpack/modules/related-posts/jetpack-related-posts.php b/plugins/jetpack/modules/related-posts/jetpack-related-posts.php
index 565759be..d7560729 100644
--- a/plugins/jetpack/modules/related-posts/jetpack-related-posts.php
+++ b/plugins/jetpack/modules/related-posts/jetpack-related-posts.php
@@ -123,7 +123,7 @@ class Jetpack_RelatedPosts {
$this->_action_frontend_init_ajax( $excludes );
} else {
- if ( isset( $_GET['relatedposts_hit'] ) ) {
+ if ( isset( $_GET['relatedposts_hit'], $_GET['relatedposts_origin'], $_GET['relatedposts_position'] ) ) {
$this->_log_click( $_GET['relatedposts_origin'], get_the_ID(), $_GET['relatedposts_position'] );
$this->_previous_post_id = (int) $_GET['relatedposts_origin'];
}
@@ -1223,8 +1223,20 @@ EOT;
* @return null
*/
protected function _enqueue_assets( $script, $style ) {
- if ( $script )
+ if ( $script ) {
wp_enqueue_script( 'jetpack_related-posts', plugins_url( 'related-posts.js', __FILE__ ), array( 'jquery' ), self::VERSION );
+ $related_posts_js_options = array(
+ /**
+ * Filter each Related Post Heading structure.
+ *
+ * @since 4.0.0
+ *
+ * @param string $str Related Post Heading structure. Default to h4.
+ */
+ 'post_heading' => apply_filters( 'jetpack_relatedposts_filter_post_heading', esc_attr( 'h4' ) ),
+ );
+ wp_localize_script( 'jetpack_related-posts', 'related_posts_js_options', $related_posts_js_options );
+ }
if ( $style ){
if( is_rtl() ) {
wp_enqueue_style( 'jetpack_related-posts', plugins_url( 'rtl/related-posts-rtl.css', __FILE__ ), array(), self::VERSION );