Skip to content

Commit

Permalink
enable belowpost to use adflow with fallback support
Browse files Browse the repository at this point in the history
  • Loading branch information
Alameen688 committed Nov 26, 2024
1 parent 6366f57 commit 6e3ae0d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
11 changes: 10 additions & 1 deletion projects/plugins/jetpack/modules/wordads/class-wordads.php
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,16 @@ public function insert_head_meta() {
</script>
<?php

$section_id = $this->params->blog_id . 5;

// Get below post tag.
$tag_belowpost = $this->get_fallback_ad_snippet( $section_id, 'square', 'belowpost', '', '{{unique_id}}' );

// Remove linebreaks and sanitize.
$tag_belowpost = esc_js( str_replace( array( "\n", "\t", "\r" ), '', $tag_belowpost ) );

// Get an inline tag with a macro as id handled on JS side to use as a fallback.
$tag_inline = $this->get_fallback_ad_snippet( $this->params->blog_id . 5, 'square', 'inline', '', '{{unique_id}}' );
$tag_inline = $this->get_fallback_ad_snippet( $section_id, 'square', 'inline', '', '{{unique_id}}' );

// Remove linebreaks and sanitize.
$tag_inline = esc_js( str_replace( array( "\n", "\t", "\r" ), '', $tag_inline ) );
Expand All @@ -393,6 +401,7 @@ public function insert_head_meta() {
var sas_fallback = sas_fallback || [];
sas_fallback.push(
{ tag: "$tag_inline", type: 'inline' }
{ tag: "$tag_belowpost", type: 'belowpost' }
);
</script>
HTML;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,10 @@ public function insert_config() {
'enabled' => $this->is_inline_enabled,
),
'bottom_sticky' => array(
'enabled' => true,
'enabled' => true, // TODO: this will not be true by default
),
'belowpost' => array(
'enabled' => true, // TODO: this will not be true by default
),
);

Expand Down

0 comments on commit 6e3ae0d

Please sign in to comment.