Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/accelera.../template...
File: frontpage-elements.php
<?php
[0] Fix | Delete
// Exit if accessed directly
[1] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[2] Fix | Delete
exit;
[3] Fix | Delete
}
[4] Fix | Delete
add_action('pre_amp_render_post', 'ampforwp_frontpage_file', 11);
[5] Fix | Delete
function ampforwp_frontpage_file() {
[6] Fix | Delete
global $redux_builder_amp;
[7] Fix | Delete
[8] Fix | Delete
// Title
[9] Fix | Delete
// Design #2
[10] Fix | Delete
add_action('ampforwp_design_2_frontpage_title','ampforwp_design_2_frontpage_title');
[11] Fix | Delete
// Design #3
[12] Fix | Delete
add_action('ampforwp_design_3_frontpage_title','ampforwp_design_3_frontpage_title');
[13] Fix | Delete
[14] Fix | Delete
// Content
[15] Fix | Delete
if ( $redux_builder_amp['amp-design-selector'] == '1') {
[16] Fix | Delete
add_action('ampforwp_frontpage_above_loop', 'ampforwp_design_1_frontpage_content', 10 , 2);
[17] Fix | Delete
}
[18] Fix | Delete
if ( $redux_builder_amp['amp-design-selector'] == '2') {
[19] Fix | Delete
add_action('ampforwp_frontpage_above_loop', 'ampforwp_design_2_frontpage_content', 10 , 2);
[20] Fix | Delete
}
[21] Fix | Delete
if ( $redux_builder_amp['amp-design-selector'] == '3') {
[22] Fix | Delete
add_action('ampforwp_frontpage_above_loop', 'ampforwp_design_3_frontpage_content', 10 , 2);
[23] Fix | Delete
}
[24] Fix | Delete
}
[25] Fix | Delete
[26] Fix | Delete
// TODO: refine this file. #890
[27] Fix | Delete
[28] Fix | Delete
// Design #1
[29] Fix | Delete
function ampforwp_design_1_frontpage_content( $template, $post_id ){
[30] Fix | Delete
global $redux_builder_amp;
[31] Fix | Delete
//WPML Static Front Page Support #1111
[32] Fix | Delete
if( function_exists('wpml_core_loads_first')){
[33] Fix | Delete
$post_id = get_option('page_on_front');
[34] Fix | Delete
[35] Fix | Delete
}
[36] Fix | Delete
$amp_custom_content_enable = get_post_meta($post_id, 'ampforwp_custom_content_editor_checkbox', true);?>
[37] Fix | Delete
<article class="amp-wp-article">
[38] Fix | Delete
[39] Fix | Delete
<?php if( ampforwp_get_setting('ampforwp-title-on-front-page') && !ampforwp_default_logo()) { ?>
[40] Fix | Delete
<header class="amp-wp-article-header ampforwp-title">
[41] Fix | Delete
<h2 class="amp-wp-title"><?php echo get_the_title( $post_id );?></h2>
[42] Fix | Delete
</header>
[43] Fix | Delete
<?php }
[44] Fix | Delete
elseif(ampforwp_get_setting('ampforwp-title-on-front-page') && ampforwp_default_logo()){?>
[45] Fix | Delete
<header class="amp-wp-article-header ampforwp-title">
[46] Fix | Delete
<h1 class="amp-wp-title"><?php echo get_the_title( $post_id );?></h1>
[47] Fix | Delete
</header>
[48] Fix | Delete
<?php }
[49] Fix | Delete
do_action('ampforwp_before_featured_image_hook', $template ); ?>
[50] Fix | Delete
<?php $featured_image = $template->get( 'featured_image' );
[51] Fix | Delete
if ( $featured_image ) {
[52] Fix | Delete
$amp_html = $featured_image['amp_html'];
[53] Fix | Delete
$caption = $featured_image['caption']; ?>
[54] Fix | Delete
<figure class="amp-wp-article-featured-image wp-caption">
[55] Fix | Delete
<?php echo $amp_html; // amphtml content; no kses ?>
[56] Fix | Delete
<?php if ( $caption ) : ?>
[57] Fix | Delete
<p class="wp-caption-text">
[58] Fix | Delete
<?php echo wp_kses_data( $caption ); ?>
[59] Fix | Delete
</p>
[60] Fix | Delete
<?php endif; ?>
[61] Fix | Delete
</figure>
[62] Fix | Delete
<?php }
[63] Fix | Delete
do_action('ampforwp_after_featured_image_hook', $template ); ?>
[64] Fix | Delete
[65] Fix | Delete
<div class="amp-wp-content the_content">
[66] Fix | Delete
[67] Fix | Delete
<?php
[68] Fix | Delete
do_action( 'ampforwp_before_post_content', $template );
[69] Fix | Delete
[70] Fix | Delete
// Normal Front Page Content
[71] Fix | Delete
if ( ! $amp_custom_content_enable ) {
[72] Fix | Delete
$ampforwp_the_content = $template->get('post_amp_content');
[73] Fix | Delete
} else {
[74] Fix | Delete
// Custom/Alternative AMP content added through post meta
[75] Fix | Delete
$ampforwp_the_content = $template->get('ampforwp_amp_content');
[76] Fix | Delete
}
[77] Fix | Delete
// Muffin Builder Compatibility #1455 #1893
[78] Fix | Delete
if ( function_exists('mfn_builder_print') && ! $amp_custom_content_enable ) {
[79] Fix | Delete
ob_start();
[80] Fix | Delete
mfn_builder_print( $post_id );
[81] Fix | Delete
$content = ob_get_contents();
[82] Fix | Delete
ob_end_clean();
[83] Fix | Delete
$sanitizer_obj = new AMPFORWP_Content( $content,
[84] Fix | Delete
array(),
[85] Fix | Delete
apply_filters( 'ampforwp_content_sanitizers',
[86] Fix | Delete
array( 'AMP_Img_Sanitizer' => array(),
[87] Fix | Delete
'AMP_Blacklist_Sanitizer' => array(),
[88] Fix | Delete
'AMP_Style_Sanitizer' => array(),
[89] Fix | Delete
'AMP_Video_Sanitizer' => array(),
[90] Fix | Delete
'AMP_Audio_Sanitizer' => array(),
[91] Fix | Delete
'AMP_Iframe_Sanitizer' => array(
[92] Fix | Delete
'add_placeholder' => true,
[93] Fix | Delete
),
[94] Fix | Delete
)
[95] Fix | Delete
)
[96] Fix | Delete
);
[97] Fix | Delete
if ( ! get_post_meta( $post_id, 'mfn-post-hide-content', true ) ) {
[98] Fix | Delete
$ampforwp_custom_amp_editor_content = '';
[99] Fix | Delete
$ampforwp_custom_amp_editor_content = $ampforwp_the_content;
[100] Fix | Delete
$ampforwp_the_content = $sanitizer_obj->get_amp_content();
[101] Fix | Delete
$ampforwp_the_content .= $ampforwp_custom_amp_editor_content;
[102] Fix | Delete
}
[103] Fix | Delete
else{
[104] Fix | Delete
$ampforwp_the_content = $sanitizer_obj->get_amp_content();
[105] Fix | Delete
}
[106] Fix | Delete
}
[107] Fix | Delete
$ampforwp_the_content = apply_filters('ampforwp_modify_the_content', $ampforwp_the_content);
[108] Fix | Delete
echo $ampforwp_the_content; // amphtml content; no kses
[109] Fix | Delete
do_action( 'ampforwp_after_post_content', $template );
[110] Fix | Delete
?>
[111] Fix | Delete
[112] Fix | Delete
</div>
[113] Fix | Delete
[114] Fix | Delete
<?php ampforwp_frontpage_comments(); ?>
[115] Fix | Delete
[116] Fix | Delete
<div class="amp-wp-content post-pagination-meta">
[117] Fix | Delete
<?php $template->load_parts( apply_filters( 'amp_post_template_meta_parts', array( 'meta-taxonomy' ) ) ); ?>
[118] Fix | Delete
</div>
[119] Fix | Delete
</article> <?php
[120] Fix | Delete
}
[121] Fix | Delete
[122] Fix | Delete
[123] Fix | Delete
// Design #2
[124] Fix | Delete
function ampforwp_design_2_frontpage_content($template, $post_id){
[125] Fix | Delete
global $redux_builder_amp;
[126] Fix | Delete
//WPML Static Front Page Support #1111
[127] Fix | Delete
if( function_exists('wpml_core_loads_first')){
[128] Fix | Delete
$post_id = get_option('page_on_front');
[129] Fix | Delete
}
[130] Fix | Delete
do_action( 'ampforwp_design_2_frontpage_title', $template );
[131] Fix | Delete
$amp_custom_content_enable = get_post_meta($post_id, 'ampforwp_custom_content_editor_checkbox', true); ?>
[132] Fix | Delete
<?php do_action('ampforwp_before_featured_image_hook', $template ); ?>
[133] Fix | Delete
<?php $featured_image = $template->get( 'featured_image' );
[134] Fix | Delete
if ( $featured_image ) {
[135] Fix | Delete
$amp_html = $featured_image['amp_html'];
[136] Fix | Delete
$caption = $featured_image['caption']; ?>
[137] Fix | Delete
<div class="amp-wp-article-featured-image amp-wp-content featured-image-content">
[138] Fix | Delete
<figure class="amp-wp-article-featured-image wp-caption">
[139] Fix | Delete
<?php echo $amp_html; // amphtml content; no kses ?>
[140] Fix | Delete
<?php if ( $caption ) : ?>
[141] Fix | Delete
<p class="wp-caption-text">
[142] Fix | Delete
<?php echo wp_kses_data( $caption ); ?>
[143] Fix | Delete
</p>
[144] Fix | Delete
<?php endif; ?>
[145] Fix | Delete
</figure>
[146] Fix | Delete
</div> <?php
[147] Fix | Delete
}
[148] Fix | Delete
do_action('ampforwp_after_featured_image_hook', $template ); ?>
[149] Fix | Delete
[150] Fix | Delete
<div class="amp-wp-content the_content">
[151] Fix | Delete
[152] Fix | Delete
<?php
[153] Fix | Delete
// Normal Front Page Content
[154] Fix | Delete
if ( ! $amp_custom_content_enable ) {
[155] Fix | Delete
$ampforwp_the_content = $template->get('post_amp_content');
[156] Fix | Delete
} else {
[157] Fix | Delete
// Custom/Alternative AMP content added through post meta
[158] Fix | Delete
$ampforwp_the_content = $template->get('ampforwp_amp_content');
[159] Fix | Delete
}
[160] Fix | Delete
// Muffin Builder Compatibility #1455 #1893
[161] Fix | Delete
if ( function_exists('mfn_builder_print') && ! $amp_custom_content_enable ) {
[162] Fix | Delete
ob_start();
[163] Fix | Delete
mfn_builder_print( $post_id );
[164] Fix | Delete
$content = ob_get_contents();
[165] Fix | Delete
ob_end_clean();
[166] Fix | Delete
$sanitizer_obj = new AMPFORWP_Content( $content,
[167] Fix | Delete
array(),
[168] Fix | Delete
apply_filters( 'ampforwp_content_sanitizers',
[169] Fix | Delete
array( 'AMP_Img_Sanitizer' => array(),
[170] Fix | Delete
'AMP_Blacklist_Sanitizer' => array(),
[171] Fix | Delete
'AMP_Style_Sanitizer' => array(),
[172] Fix | Delete
'AMP_Video_Sanitizer' => array(),
[173] Fix | Delete
'AMP_Audio_Sanitizer' => array(),
[174] Fix | Delete
'AMP_Iframe_Sanitizer' => array(
[175] Fix | Delete
'add_placeholder' => true,
[176] Fix | Delete
),
[177] Fix | Delete
)
[178] Fix | Delete
)
[179] Fix | Delete
);
[180] Fix | Delete
if ( ! get_post_meta( $post_id, 'mfn-post-hide-content', true ) ) {
[181] Fix | Delete
$ampforwp_custom_amp_editor_content = '';
[182] Fix | Delete
$ampforwp_custom_amp_editor_content = $ampforwp_the_content;
[183] Fix | Delete
$ampforwp_the_content = $sanitizer_obj->get_amp_content();
[184] Fix | Delete
$ampforwp_the_content .= $ampforwp_custom_amp_editor_content;
[185] Fix | Delete
}
[186] Fix | Delete
else{
[187] Fix | Delete
$ampforwp_the_content = $sanitizer_obj->get_amp_content();
[188] Fix | Delete
}
[189] Fix | Delete
}
[190] Fix | Delete
$ampforwp_the_content = apply_filters('ampforwp_modify_the_content', $ampforwp_the_content);
[191] Fix | Delete
echo $ampforwp_the_content; // amphtml content; no kses
[192] Fix | Delete
do_action( 'ampforwp_after_post_content', $template ); ?>
[193] Fix | Delete
[194] Fix | Delete
</div>
[195] Fix | Delete
[196] Fix | Delete
<?php ampforwp_frontpage_comments(); ?>
[197] Fix | Delete
[198] Fix | Delete
<div class="amp-wp-content post-pagination-meta">
[199] Fix | Delete
<?php $template->load_parts( apply_filters( 'amp_post_template_meta_parts', array( 'meta-taxonomy' ) ) ); ?>
[200] Fix | Delete
</div>
[201] Fix | Delete
[202] Fix | Delete
[203] Fix | Delete
<?php
[204] Fix | Delete
}
[205] Fix | Delete
[206] Fix | Delete
// Design #3
[207] Fix | Delete
function ampforwp_design_3_frontpage_content($template, $post_id){
[208] Fix | Delete
global $redux_builder_amp;
[209] Fix | Delete
//WPML Static Front Page Support #1111
[210] Fix | Delete
if( function_exists('wpml_core_loads_first')){
[211] Fix | Delete
$post_id = get_option('page_on_front');
[212] Fix | Delete
[213] Fix | Delete
}
[214] Fix | Delete
$amp_custom_content_enable = get_post_meta( $post_id, 'ampforwp_custom_content_editor_checkbox', true);?>
[215] Fix | Delete
<main>
[216] Fix | Delete
<article class="amp-wp-article">
[217] Fix | Delete
<div class="amp-wp-article-content">
[218] Fix | Delete
<?php do_action( 'ampforwp_design_3_frontpage_title', $template ); ?>
[219] Fix | Delete
<?php do_action('ampforwp_before_featured_image_hook', $template ); ?>
[220] Fix | Delete
<?php $featured_image = $template->get( 'featured_image' );
[221] Fix | Delete
if ( $featured_image ) {
[222] Fix | Delete
$amp_html = $featured_image['amp_html'];
[223] Fix | Delete
$caption = $featured_image['caption']; ?>
[224] Fix | Delete
<div class="amp-wp-article-featured-image amp-wp-content featured-image-content">
[225] Fix | Delete
<figure class="amp-wp-article-featured-image wp-caption">
[226] Fix | Delete
<?php echo $amp_html; // amphtml content; no kses ?>
[227] Fix | Delete
<?php if ( $caption ) : ?>
[228] Fix | Delete
<p class="wp-caption-text">
[229] Fix | Delete
<?php echo wp_kses_data( $caption ); ?>
[230] Fix | Delete
</p>
[231] Fix | Delete
<?php endif; ?>
[232] Fix | Delete
</figure>
[233] Fix | Delete
</div> <?php
[234] Fix | Delete
}
[235] Fix | Delete
do_action('ampforwp_after_featured_image_hook', $template ); ?>
[236] Fix | Delete
[237] Fix | Delete
<div class="amp-wp-content the_content">
[238] Fix | Delete
<?php
[239] Fix | Delete
// Normal Front Page Content
[240] Fix | Delete
if ( ! $amp_custom_content_enable ) {
[241] Fix | Delete
$ampforwp_the_content = $template->get('post_amp_content');
[242] Fix | Delete
} else {
[243] Fix | Delete
// Custom/Alternative AMP content added through post meta
[244] Fix | Delete
$ampforwp_the_content = $template->get('ampforwp_amp_content');
[245] Fix | Delete
}
[246] Fix | Delete
// Muffin Builder Compatibility #1455 #1893
[247] Fix | Delete
if ( function_exists('mfn_builder_print') && ! $amp_custom_content_enable ) {
[248] Fix | Delete
ob_start();
[249] Fix | Delete
mfn_builder_print( $post_id );
[250] Fix | Delete
$content = ob_get_contents();
[251] Fix | Delete
ob_end_clean();
[252] Fix | Delete
$sanitizer_obj = new AMPFORWP_Content( $content,
[253] Fix | Delete
array(),
[254] Fix | Delete
apply_filters( 'ampforwp_content_sanitizers',
[255] Fix | Delete
array( 'AMP_Img_Sanitizer' => array(),
[256] Fix | Delete
'AMP_Blacklist_Sanitizer' => array(),
[257] Fix | Delete
'AMP_Style_Sanitizer' => array(),
[258] Fix | Delete
'AMP_Video_Sanitizer' => array(),
[259] Fix | Delete
'AMP_Audio_Sanitizer' => array(),
[260] Fix | Delete
'AMP_Iframe_Sanitizer' => array(
[261] Fix | Delete
'add_placeholder' => true,
[262] Fix | Delete
),
[263] Fix | Delete
)
[264] Fix | Delete
)
[265] Fix | Delete
);
[266] Fix | Delete
if ( ! get_post_meta( $post_id, 'mfn-post-hide-content', true ) ) {
[267] Fix | Delete
$ampforwp_custom_amp_editor_content = '';
[268] Fix | Delete
$ampforwp_custom_amp_editor_content = $ampforwp_the_content;
[269] Fix | Delete
$ampforwp_the_content = $sanitizer_obj->get_amp_content();
[270] Fix | Delete
$ampforwp_the_content .= $ampforwp_custom_amp_editor_content;
[271] Fix | Delete
}
[272] Fix | Delete
else{
[273] Fix | Delete
$ampforwp_the_content = $sanitizer_obj->get_amp_content();
[274] Fix | Delete
}
[275] Fix | Delete
}
[276] Fix | Delete
$ampforwp_the_content = apply_filters('ampforwp_modify_the_content', $ampforwp_the_content);
[277] Fix | Delete
echo $ampforwp_the_content; // amphtml content; no kses
[278] Fix | Delete
do_action( 'ampforwp_after_post_content', $template ); ?>
[279] Fix | Delete
[280] Fix | Delete
</div>
[281] Fix | Delete
[282] Fix | Delete
<?php ampforwp_frontpage_comments(); ?>
[283] Fix | Delete
[284] Fix | Delete
<div class="amp-wp-content post-pagination-meta">
[285] Fix | Delete
<?php $template->load_parts( apply_filters( 'amp_post_template_meta_parts', array( 'meta-taxonomy' ) ) ); ?>
[286] Fix | Delete
</div>
[287] Fix | Delete
</div>
[288] Fix | Delete
</article>
[289] Fix | Delete
</main>
[290] Fix | Delete
<?php
[291] Fix | Delete
}
[292] Fix | Delete
[293] Fix | Delete
[294] Fix | Delete
// Frontpage Title for Design #2
[295] Fix | Delete
function ampforwp_design_2_frontpage_title() {
[296] Fix | Delete
global $redux_builder_amp;
[297] Fix | Delete
//WPML Static Front Page Support #1111
[298] Fix | Delete
if( function_exists('wpml_core_loads_first' )){
[299] Fix | Delete
$ID = get_option('page_on_front');
[300] Fix | Delete
}else{
[301] Fix | Delete
$ID = ampforwp_get_frontpage_id();
[302] Fix | Delete
}
[303] Fix | Delete
if( ampforwp_get_setting('ampforwp-title-on-front-page') && !ampforwp_default_logo() ) { ?>
[304] Fix | Delete
<header class="amp-wp-article-header ampforwp-title">
[305] Fix | Delete
<h2 class="amp-wp-title"><?php echo get_the_title( $ID );?></h2>
[306] Fix | Delete
</header>
[307] Fix | Delete
<?php }elseif(ampforwp_get_setting('ampforwp-title-on-front-page') && ampforwp_default_logo()){?>
[308] Fix | Delete
<header class="amp-wp-article-header ampforwp-title">
[309] Fix | Delete
<h1 class="amp-wp-title"><?php echo get_the_title( $ID );?></h1>
[310] Fix | Delete
</header>
[311] Fix | Delete
<?php }
[312] Fix | Delete
}
[313] Fix | Delete
[314] Fix | Delete
// Frontpage Title for Design #3
[315] Fix | Delete
function ampforwp_design_3_frontpage_title() {
[316] Fix | Delete
//WPML Static Front Page Support #1111
[317] Fix | Delete
if( function_exists('wpml_core_loads_first' )){
[318] Fix | Delete
$ID = get_option('page_on_front');
[319] Fix | Delete
}else{
[320] Fix | Delete
$ID = ampforwp_get_frontpage_id();
[321] Fix | Delete
}
[322] Fix | Delete
?>
[323] Fix | Delete
<header class="amp-wp-article-header ampforwp-title amp-wp-content">
[324] Fix | Delete
<?php if( true == ampforwp_get_setting('ampforwp-title-on-front-page') && !ampforwp_default_logo() ) { ?>
[325] Fix | Delete
<h2 class="amp-wp-title"><?php echo get_the_title( $ID );?></h2>
[326] Fix | Delete
<?php
[327] Fix | Delete
}elseif(ampforwp_get_setting('ampforwp-title-on-front-page') && ampforwp_default_logo()){?>
[328] Fix | Delete
<h1 class="amp-wp-title"><?php echo get_the_title( $ID );?></h1>
[329] Fix | Delete
<?php
[330] Fix | Delete
} ?>
[331] Fix | Delete
</header>
[332] Fix | Delete
[333] Fix | Delete
<?php }
[334] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function