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.../includes
File: thirdparty-compatibility.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
//Remove ResponsifyWP #1131
[5] Fix | Delete
add_action('plugins_loaded', 'ampforwp_filter_remove_function_responsifywp');
[6] Fix | Delete
function ampforwp_filter_remove_function_responsifywp(){
[7] Fix | Delete
if(is_plugin_active('responsify-wp/responsify-wp.php')){
[8] Fix | Delete
add_filter('rwp_add_filters','removeFilterOfResponsify');
[9] Fix | Delete
function removeFilterOfResponsify($filter){
[10] Fix | Delete
return '';
[11] Fix | Delete
}
[12] Fix | Delete
}
[13] Fix | Delete
}
[14] Fix | Delete
[15] Fix | Delete
add_action('pre_amp_render_post','ampforwp_thirdparty_compatibility');
[16] Fix | Delete
function ampforwp_thirdparty_compatibility(){
[17] Fix | Delete
// Remove Schema theme Lazy Load #1170
[18] Fix | Delete
remove_filter( 'wp_get_attachment_image_attributes', 'mts_image_lazy_load_attr', 10, 3 );
[19] Fix | Delete
remove_filter('the_content', 'mts_content_image_lazy_load_attr');
[20] Fix | Delete
//Remove CSS header from the GoodLife Theme #2673
[21] Fix | Delete
remove_filter('amp_post_template_file', 'thb_custom_amp_templates');
[22] Fix | Delete
remove_action( 'amp_post_template_css', 'thb_amp_additional_css_styles' );
[23] Fix | Delete
// Viewport appear more than once in Zox news theme. #2971
[24] Fix | Delete
if ( function_exists( 'mvp_setup' ) && ampforwp_get_setting('amp-design-selector') != 4 ) {
[25] Fix | Delete
remove_action( 'amp_post_template_head','ampforwp_add_meta_viewport');
[26] Fix | Delete
}
[27] Fix | Delete
//Menu css is not loading when directory plus theme is active. #2963
[28] Fix | Delete
remove_filter('wp_nav_menu_args',array('AitMenu','modify_arguments'),100);
[29] Fix | Delete
// #3124 enfold theme shortcodes removed
[30] Fix | Delete
add_filter('the_content','ampforwp_remove_enfold_theme_shortcodes_tags');
[31] Fix | Delete
[32] Fix | Delete
if ( in_array( 'wordproof-timestamp/wordproof-timestamp.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
[33] Fix | Delete
add_filter('amp_post_template_data','ampforwp_compatibility_filter_tags_for_wordproof_plugin');
[34] Fix | Delete
}
[35] Fix | Delete
if ( in_array( 'opensea/opensea.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
[36] Fix | Delete
add_filter('amp_post_template_data','ampforwp_compatibility_for_opensea_plugin');
[37] Fix | Delete
}
[38] Fix | Delete
[39] Fix | Delete
add_filter('amp_post_template_data','ampforwp_add_target_attribute_in_form_tags');
[40] Fix | Delete
// AMP is not working due to JCH Optimize Pro plugin #3185
[41] Fix | Delete
remove_action('shutdown', 'jch_buffer_end', -1);
[42] Fix | Delete
//ShortPixel Plugin Compatibility to remove picture tag in amp #3439
[43] Fix | Delete
remove_filter( 'the_content', 'shortPixelConvertImgToPictureAddWebp', 10000 );
[44] Fix | Delete
remove_filter( 'the_excerpt', 'shortPixelConvertImgToPictureAddWebp', 10000 );
[45] Fix | Delete
remove_filter( 'post_thumbnail_html', 'shortPixelConvertImgToPictureAddWebp');
[46] Fix | Delete
//Validation error with Authentic theme #3535
[47] Fix | Delete
remove_filter( 'amp_post_template_data', 'csco_amp_post_template_data', 10, 2 );
[48] Fix | Delete
//Breaking the layout with diginex theme #4068
[49] Fix | Delete
if(function_exists('airkit_widgetFileAutoloader')){
[50] Fix | Delete
remove_filter( 'amp_post_template_file', 'airkit_amp_set_custom_style_path', 10, 3 );
[51] Fix | Delete
}
[52] Fix | Delete
//Validation errors in amp category page due to HotWP PRO #3455
[53] Fix | Delete
if(function_exists('hotwp_get_option') && is_category()){
[54] Fix | Delete
remove_all_filters('get_the_archive_title');
[55] Fix | Delete
}
[56] Fix | Delete
if(function_exists('thb_remove_youtube_controls')){
[57] Fix | Delete
remove_filter( 'embed_handler_html', 'thb_remove_youtube_controls', 10, 2 );
[58] Fix | Delete
}
[59] Fix | Delete
if (function_exists('gpress_switch_theme')) {
[60] Fix | Delete
remove_filter('the_content', 'add_data_atts');
[61] Fix | Delete
}
[62] Fix | Delete
if(class_exists( 'Jetpack_RelatedPosts' ) && false == ampforwp_get_setting('ampforwp-jetpack-related-posts')){
[63] Fix | Delete
$jprp = Jetpack_RelatedPosts::init();
[64] Fix | Delete
remove_filter( 'the_content', array( $jprp, 'filter_add_target_to_dom' ), 40 );
[65] Fix | Delete
}
[66] Fix | Delete
if(function_exists('heateor_sss_save_default_options') && false == ampforwp_get_setting('ampforwp-sassy_social-switch') ){
[67] Fix | Delete
add_filter('heateor_sss_disable_sharing','ampforwp_removing_sassy_social_share');
[68] Fix | Delete
}
[69] Fix | Delete
if(function_exists('defer_parsing_of_js')){
[70] Fix | Delete
remove_filter( 'clean_url', 'defer_parsing_of_js', 11, 1 );
[71] Fix | Delete
}
[72] Fix | Delete
if(class_exists('gdlr_core_page_builder')){
[73] Fix | Delete
add_filter('the_content','ampforwp_gdlr_core_page_builder_content',12);
[74] Fix | Delete
}
[75] Fix | Delete
if(function_exists('vicomi_feelbacks_template')){
[76] Fix | Delete
remove_action('the_content', 'vicomi_feelbacks_template');
[77] Fix | Delete
}
[78] Fix | Delete
if(class_exists('FinalTiles_Gallery')){
[79] Fix | Delete
add_filter('wp_is_mobile','ampforwp_final_tiles_grid_gallery');
[80] Fix | Delete
}
[81] Fix | Delete
if(class_exists('Getty_Images')){
[82] Fix | Delete
add_filter( 'embed_oembed_html', 'ampforwp_get_gitty_image_embed',10,4);
[83] Fix | Delete
add_filter( 'ampforwp_the_content_last_filter','ampforwp_getty_image_compatibility',10);
[84] Fix | Delete
}
[85] Fix | Delete
if(function_exists('megashop_setup')){
[86] Fix | Delete
remove_filter( 'wp_nav_menu_args', 'TT_nav_menu_args' );
[87] Fix | Delete
}
[88] Fix | Delete
if (function_exists('vinkmag_action_setup')) {
[89] Fix | Delete
remove_action( 'amp_post_template_head', 'vinkmag_amp_fonts', 1 );
[90] Fix | Delete
}
[91] Fix | Delete
if(function_exists('zeen_lazyload_images')){
[92] Fix | Delete
add_filter('zeen_lazy_embedded_images','ampforwp_zeen_lazyload');
[93] Fix | Delete
}
[94] Fix | Delete
$yoast_canonical = $yoast_canonical_post = $yoast_canonical_page = '';
[95] Fix | Delete
$yoast_canonical = get_option( 'wpseo_titles' );
[96] Fix | Delete
if(isset($yoast_canonical['noindex-post'])){
[97] Fix | Delete
$yoast_canonical_post = $yoast_canonical['noindex-post'];
[98] Fix | Delete
}
[99] Fix | Delete
if(isset($yoast_canonical['noindex-page'])){
[100] Fix | Delete
$yoast_canonical_page = $yoast_canonical['noindex-page'];
[101] Fix | Delete
}
[102] Fix | Delete
if (class_exists('WPSEO_Options') && 'yoast' == ampforwp_get_setting('ampforwp-seo-selection') && $yoast_canonical_post && $yoast_canonical_page && WPSEO_Meta::get_value( 'meta-robots-noindex', ampforwp_get_the_ID()) != 2) {
[103] Fix | Delete
add_action( 'amp_post_template_head', 'AMPforWP\\AMPVendor\\amp_post_template_add_canonical' );
[104] Fix | Delete
}elseif(class_exists('WPSEO_Options') && 'yoast' == ampforwp_get_setting('ampforwp-seo-selection') && is_page() && $yoast_canonical_page ){
[105] Fix | Delete
add_action( 'amp_post_template_head', 'AMPforWP\\AMPVendor\\amp_post_template_add_canonical' );
[106] Fix | Delete
}elseif(class_exists('WPSEO_Options') && 'yoast' == ampforwp_get_setting('ampforwp-seo-selection') && is_single() && $yoast_canonical_post ){
[107] Fix | Delete
add_action( 'amp_post_template_head', 'AMPforWP\\AMPVendor\\amp_post_template_add_canonical' );
[108] Fix | Delete
}elseif (class_exists('WPSEO_Options') && 'yoast' == ampforwp_get_setting('ampforwp-seo-selection') && WPSEO_Meta::get_value( 'meta-robots-noindex', ampforwp_get_the_ID()) == 1) {
[109] Fix | Delete
add_action( 'amp_post_template_head', 'AMPforWP\\AMPVendor\\amp_post_template_add_canonical' );
[110] Fix | Delete
}
[111] Fix | Delete
if(class_exists('\\EmbedPress\\Ends\\Front\\Handler')){
[112] Fix | Delete
global $wp_embed;
[113] Fix | Delete
remove_filter('the_content', ['\\EmbedPress\\Ends\\Front\\Handler', 'autoEmbedUrls']);
[114] Fix | Delete
add_filter('the_content', [$wp_embed, 'autoembed'], 8);
[115] Fix | Delete
add_filter('the_content', [$wp_embed, 'run_shortcode'], 8);
[116] Fix | Delete
}
[117] Fix | Delete
}
[118] Fix | Delete
function ampforwp_removing_sassy_social_share(){
[119] Fix | Delete
return 1;
[120] Fix | Delete
}
[121] Fix | Delete
[122] Fix | Delete
//Updater to check license
[123] Fix | Delete
require_once AMPFORWP_PLUGIN_DIR . '/includes/updater/update.php';
[124] Fix | Delete
[125] Fix | Delete
//Facility to create child theme For AMP
[126] Fix | Delete
add_filter( 'amp_post_template_file', 'ampforwp_child_custom_header_file', 20, 3 );
[127] Fix | Delete
add_filter( 'amp_post_template_file', 'ampforwp_child_designing_custom_template', 20, 3 );
[128] Fix | Delete
add_filter( 'amp_post_template_file', 'ampforwp_child_custom_footer_file', 20, 3 );
[129] Fix | Delete
function ampforwp_theme_template_directry(){
[130] Fix | Delete
$folder_name = 'ampforwp';
[131] Fix | Delete
$folder_name = apply_filters('ampforwp_template_locate', $folder_name);
[132] Fix | Delete
return get_stylesheet_directory() . '/' . $folder_name;
[133] Fix | Delete
}
[134] Fix | Delete
// Custom Header
[135] Fix | Delete
function ampforwp_child_custom_header_file( $file, $type, $post ) {
[136] Fix | Delete
$currentFile = $file;
[137] Fix | Delete
if ( 'header' === $type ) {
[138] Fix | Delete
$file = ampforwp_theme_template_directry() . '/header.php';
[139] Fix | Delete
[140] Fix | Delete
}
[141] Fix | Delete
if ( 'header-bar' === $type ) {
[142] Fix | Delete
$file = ampforwp_theme_template_directry() . '/header-bar.php';
[143] Fix | Delete
}
[144] Fix | Delete
if(!file_exists($file)){
[145] Fix | Delete
$file = $currentFile;
[146] Fix | Delete
}
[147] Fix | Delete
return $file;
[148] Fix | Delete
}
[149] Fix | Delete
[150] Fix | Delete
// Custom Template Files
[151] Fix | Delete
function ampforwp_child_designing_custom_template( $file, $type, $post ) {
[152] Fix | Delete
if(is_page() && !is_page_template()){
[153] Fix | Delete
return $file;
[154] Fix | Delete
}
[155] Fix | Delete
global $redux_builder_amp;
[156] Fix | Delete
$currentFile = $file;
[157] Fix | Delete
$filePath = ampforwp_theme_template_directry();
[158] Fix | Delete
// Single file
[159] Fix | Delete
if ( is_single() ) {
[160] Fix | Delete
if( 'single' === $type && ! ('product' === $post->post_type) ) {
[161] Fix | Delete
$file = $filePath . '/single.php';
[162] Fix | Delete
}
[163] Fix | Delete
}
[164] Fix | Delete
if ( is_page() ) {
[165] Fix | Delete
if( 'single' === $type && ! ('product' === $post->post_type) ) {
[166] Fix | Delete
$file = $filePath . '/page.php';
[167] Fix | Delete
}
[168] Fix | Delete
}
[169] Fix | Delete
// Loop Template
[170] Fix | Delete
if ( 'loop' === $type ) {
[171] Fix | Delete
$file = $filePath . '/loop.php';
[172] Fix | Delete
}
[173] Fix | Delete
// Archive
[174] Fix | Delete
if ( is_archive() ) {
[175] Fix | Delete
if ( 'single' === $type ) {
[176] Fix | Delete
$file = $filePath . '/archive.php';
[177] Fix | Delete
}
[178] Fix | Delete
}
[179] Fix | Delete
if ( is_404() && 'single' === $type) {
[180] Fix | Delete
$file = $filePath . '/404.php';
[181] Fix | Delete
}
[182] Fix | Delete
$ampforwp_custom_post_page = ampforwp_custom_post_page();
[183] Fix | Delete
// Homepage
[184] Fix | Delete
if ( is_home() ) {
[185] Fix | Delete
if ( 'single' === $type ) {
[186] Fix | Delete
$file = $filePath . '/index.php';
[187] Fix | Delete
[188] Fix | Delete
if ( $redux_builder_amp['amp-frontpage-select-option'] == 1 ) {
[189] Fix | Delete
$file = $filePath . '/page.php';
[190] Fix | Delete
}
[191] Fix | Delete
if ( ampforwp_is_blog() ) {
[192] Fix | Delete
$file = $filePath . '/index.php';
[193] Fix | Delete
}
[194] Fix | Delete
}
[195] Fix | Delete
}
[196] Fix | Delete
// is_search
[197] Fix | Delete
if ( is_search() ) {
[198] Fix | Delete
if ( 'single' === $type ) {
[199] Fix | Delete
$file = $filePath . '/search.php';
[200] Fix | Delete
}
[201] Fix | Delete
}
[202] Fix | Delete
// Template parts
[203] Fix | Delete
if ( 4 != ampforwp_get_setting('amp-design-selector') ) {
[204] Fix | Delete
if ( 'ampforwp-the-title' === $type ) {
[205] Fix | Delete
$file = $filePath .'/elements/title.php' ;
[206] Fix | Delete
}
[207] Fix | Delete
if ( 'ampforwp-meta-info' === $type ) {
[208] Fix | Delete
$file = $filePath .'/elements/meta-info.php' ;
[209] Fix | Delete
}
[210] Fix | Delete
if ( 'ampforwp-featured-image' === $type ) {
[211] Fix | Delete
$file = $filePath .'/elements/featured-image.php' ;
[212] Fix | Delete
}
[213] Fix | Delete
if ( 'ampforwp-bread-crumbs' === $type ) {
[214] Fix | Delete
$file = $filePath .'/elements/bread-crumbs.php' ;
[215] Fix | Delete
}
[216] Fix | Delete
if ( 'ampforwp-the-content' === $type ) {
[217] Fix | Delete
$file = $filePath .'/elements/content.php' ;
[218] Fix | Delete
}
[219] Fix | Delete
if ( 'ampforwp-meta-taxonomy' === $type ) {
[220] Fix | Delete
$file = $filePath .'/elements/meta-taxonomy.php' ;
[221] Fix | Delete
}
[222] Fix | Delete
if ( 'ampforwp-social-icons' === $type ) {
[223] Fix | Delete
$file = $filePath .'/elements/social-icons.php' ;
[224] Fix | Delete
}
[225] Fix | Delete
if ( 'ampforwp-comments' === $type ) {
[226] Fix | Delete
$file = $filePath .'/elements/comments.php' ;
[227] Fix | Delete
}
[228] Fix | Delete
if ( 'ampforwp-simple-comment-button' === $type ) {
[229] Fix | Delete
$file = $filePath .'/elements/simple-comment-button.php' ;
[230] Fix | Delete
}
[231] Fix | Delete
if ( 'ampforwp-related-posts' === $type ) {
[232] Fix | Delete
$file = $filePath .'/elements/related-posts.php' ;
[233] Fix | Delete
}
[234] Fix | Delete
}
[235] Fix | Delete
//For template pages
[236] Fix | Delete
switch ( true ) {
[237] Fix | Delete
case ampforwp_is_front_page():
[238] Fix | Delete
$templates[] = $filePath . "/front-page.php";
[239] Fix | Delete
foreach ( $templates as $key => $value ) {
[240] Fix | Delete
if ( 'single' == $type && file_exists($value) ) {
[241] Fix | Delete
$file = $value;
[242] Fix | Delete
break;
[243] Fix | Delete
}
[244] Fix | Delete
}
[245] Fix | Delete
break;
[246] Fix | Delete
case ampforwp_is_home():
[247] Fix | Delete
$templates[] = $filePath . "/home.php";
[248] Fix | Delete
$templates[] = $filePath . "/index.php";
[249] Fix | Delete
foreach ( $templates as $key => $value ) {
[250] Fix | Delete
if ( 'single' == $type && file_exists($value) ) {
[251] Fix | Delete
$file = $value;
[252] Fix | Delete
break;
[253] Fix | Delete
}
[254] Fix | Delete
}
[255] Fix | Delete
break;
[256] Fix | Delete
case (is_tax()):
[257] Fix | Delete
$term = get_queried_object();
[258] Fix | Delete
$templates = array();
[259] Fix | Delete
if ( ! empty( $term->slug ) ) {
[260] Fix | Delete
$taxonomy = $term->taxonomy;
[261] Fix | Delete
$slug_decoded = urldecode( $term->slug );
[262] Fix | Delete
if ( $slug_decoded !== $term->slug ) {
[263] Fix | Delete
$templates[] = $filePath . "/taxonomy-$taxonomy-{$slug_decoded}.php";
[264] Fix | Delete
}
[265] Fix | Delete
$templates[] = $filePath . "/taxonomy-$taxonomy-{$term->slug}.php";
[266] Fix | Delete
$templates[] = $filePath . "/taxonomy-$taxonomy.php";
[267] Fix | Delete
}
[268] Fix | Delete
$templates[] = $filePath . "/taxonomy.php";
[269] Fix | Delete
foreach ( $templates as $key => $value ) {
[270] Fix | Delete
if ( 'single' === $type && file_exists($value) ) {
[271] Fix | Delete
$file = $value;
[272] Fix | Delete
break;
[273] Fix | Delete
}
[274] Fix | Delete
}
[275] Fix | Delete
break;
[276] Fix | Delete
case (is_category()):
[277] Fix | Delete
$category = get_queried_object();
[278] Fix | Delete
$templates = array();
[279] Fix | Delete
if ( ! empty( $category->slug ) ) {
[280] Fix | Delete
$slug_decoded = urldecode( $category->slug );
[281] Fix | Delete
if ( $slug_decoded !== $category->slug ) {
[282] Fix | Delete
$templates[] = $filePath . "/category-{$slug_decoded}.php";
[283] Fix | Delete
}
[284] Fix | Delete
$templates[] = $filePath . "/category-{$category->slug}.php";
[285] Fix | Delete
$templates[] = $filePath . "/category-{$category->term_id}.php";
[286] Fix | Delete
}
[287] Fix | Delete
$templates[] = $filePath . '/category.php';
[288] Fix | Delete
foreach ( $templates as $key => $value ) {
[289] Fix | Delete
if ( 'single' === $type && file_exists($value) ) {
[290] Fix | Delete
$file = $value;
[291] Fix | Delete
break;
[292] Fix | Delete
}
[293] Fix | Delete
}
[294] Fix | Delete
break;
[295] Fix | Delete
case (is_tag()):
[296] Fix | Delete
$tag = get_queried_object();
[297] Fix | Delete
$templates = array();
[298] Fix | Delete
if ( ! empty( $tag->slug ) ) {
[299] Fix | Delete
$slug_decoded = urldecode( $tag->slug );
[300] Fix | Delete
if ( $slug_decoded !== $tag->slug ) {
[301] Fix | Delete
$templates[] = $filePath . "/tag-{$slug_decoded}.php";
[302] Fix | Delete
}
[303] Fix | Delete
$templates[] = $filePath . "/tag-{$tag->slug}.php";
[304] Fix | Delete
$templates[] = $filePath . "/tag-{$tag->term_id}.php";
[305] Fix | Delete
}
[306] Fix | Delete
$templates[] = $filePath . '/tag.php';
[307] Fix | Delete
foreach ( $templates as $key => $value ) {
[308] Fix | Delete
if ( 'single' === $type && file_exists($value) ) {
[309] Fix | Delete
$file = $value;
[310] Fix | Delete
break;
[311] Fix | Delete
}
[312] Fix | Delete
}
[313] Fix | Delete
break;
[314] Fix | Delete
case is_author():
[315] Fix | Delete
$author = get_queried_object();
[316] Fix | Delete
[317] Fix | Delete
$templates = array();
[318] Fix | Delete
[319] Fix | Delete
if ( $author instanceof WP_User ) {
[320] Fix | Delete
$templates[] = $filePath . "/author-{$author->user_nicename}.php";
[321] Fix | Delete
$templates[] = $filePath . "/author-{$author->ID}.php";
[322] Fix | Delete
}
[323] Fix | Delete
$templates[] = $filePath . "/author.php";
[324] Fix | Delete
[325] Fix | Delete
foreach ( $templates as $key => $value ) {
[326] Fix | Delete
if ( 'single' === $type && file_exists($value) ) {
[327] Fix | Delete
$file = $value;
[328] Fix | Delete
break;
[329] Fix | Delete
}
[330] Fix | Delete
}
[331] Fix | Delete
break;
[332] Fix | Delete
case (is_archive()):
[333] Fix | Delete
$ptype = esc_attr(get_query_var( 'post_type' ));
[334] Fix | Delete
$post_types = array_filter( (array) $ptype );
[335] Fix | Delete
$templates = array();
[336] Fix | Delete
if ( count( $post_types ) == 1 ) {
[337] Fix | Delete
$post_type = reset( $post_types );
[338] Fix | Delete
$templates[] = $filePath . "/archive-{$post_type}.php";
[339] Fix | Delete
}
[340] Fix | Delete
$templates[] = $filePath . '/archive.php';
[341] Fix | Delete
foreach ( $templates as $key => $value ) {
[342] Fix | Delete
if ( 'single' === $type && file_exists($value) ) {
[343] Fix | Delete
$file = $value;
[344] Fix | Delete
break;
[345] Fix | Delete
}
[346] Fix | Delete
}
[347] Fix | Delete
break;
[348] Fix | Delete
case (is_post_type_archive()):
[349] Fix | Delete
$post_type = get_query_var( 'post_type' );
[350] Fix | Delete
if ( is_array( $post_type ) )
[351] Fix | Delete
$post_type = reset( $post_type );
[352] Fix | Delete
[353] Fix | Delete
$obj = get_post_type_object( $post_type );
[354] Fix | Delete
if ( ! ($obj instanceof WP_Post_Type) || ! $obj->has_archive ) {
[355] Fix | Delete
//return '';
[356] Fix | Delete
break;
[357] Fix | Delete
}
[358] Fix | Delete
$ptype = esc_attr(get_query_var( 'post_type' ));
[359] Fix | Delete
$post_types = array_filter( (array) $ptype );
[360] Fix | Delete
[361] Fix | Delete
$templates = array();
[362] Fix | Delete
[363] Fix | Delete
if ( count( $post_types ) == 1 ) {
[364] Fix | Delete
$post_type = reset( $post_types );
[365] Fix | Delete
$templates[] = $filePath . "/archive-{$post_type}.php";
[366] Fix | Delete
}
[367] Fix | Delete
$templates[] = $filePath . '/archive.php';
[368] Fix | Delete
foreach ( $templates as $key => $value ) {
[369] Fix | Delete
if ( 'single' === $type && file_exists($value) ) {
[370] Fix | Delete
$file = $value;
[371] Fix | Delete
break;
[372] Fix | Delete
}
[373] Fix | Delete
}
[374] Fix | Delete
break;
[375] Fix | Delete
case is_single():
[376] Fix | Delete
$object = get_queried_object();
[377] Fix | Delete
[378] Fix | Delete
$templates = array();
[379] Fix | Delete
[380] Fix | Delete
if ( ! empty( $object->post_type ) ) {
[381] Fix | Delete
$template = get_page_template_slug( $object );
[382] Fix | Delete
if ( $template && 0 === validate_file( $template ) ) {
[383] Fix | Delete
$templates[] = $filePath.'/'.$template;
[384] Fix | Delete
}
[385] Fix | Delete
[386] Fix | Delete
$name_decoded = urldecode( $object->post_name );
[387] Fix | Delete
if ( $name_decoded !== $object->post_name ) {
[388] Fix | Delete
$templates[] = $filePath . "/single-{$object->post_type}-{$name_decoded}.php";
[389] Fix | Delete
}
[390] Fix | Delete
[391] Fix | Delete
$templates[] = $filePath . "/single-{$object->post_type}-{$object->post_name}.php";
[392] Fix | Delete
$templates[] = $filePath . "/single-{$object->post_type}.php";
[393] Fix | Delete
}
[394] Fix | Delete
[395] Fix | Delete
$templates[] = $filePath . "/single.php";
[396] Fix | Delete
[397] Fix | Delete
foreach ( $templates as $key => $value ) {
[398] Fix | Delete
if ( 'single' === $type && file_exists($value) ) {
[399] Fix | Delete
$file = $value;
[400] Fix | Delete
break;
[401] Fix | Delete
}
[402] Fix | Delete
}
[403] Fix | Delete
break;
[404] Fix | Delete
case is_page():
[405] Fix | Delete
$id = get_queried_object_id();
[406] Fix | Delete
$template = get_page_template_slug();
[407] Fix | Delete
$pagename = get_query_var('pagename');
[408] Fix | Delete
[409] Fix | Delete
if ( ! $pagename && $id ) {
[410] Fix | Delete
// If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object
[411] Fix | Delete
$post = get_queried_object();
[412] Fix | Delete
if ( $post )
[413] Fix | Delete
$pagename = $post->post_name;
[414] Fix | Delete
}
[415] Fix | Delete
[416] Fix | Delete
$templates = array();
[417] Fix | Delete
if ( $template && 0 === validate_file( $template ) )
[418] Fix | Delete
$templates[] = $filePath.'/'.$template;
[419] Fix | Delete
if ( $pagename ) {
[420] Fix | Delete
$pagename_decoded = urldecode( $pagename );
[421] Fix | Delete
if ( $pagename_decoded !== $pagename ) {
[422] Fix | Delete
$templates[] = $filePath . "/page-{$pagename_decoded}.php";
[423] Fix | Delete
}
[424] Fix | Delete
$templates[] = $filePath . "/page-{$pagename}.php";
[425] Fix | Delete
}
[426] Fix | Delete
if ( $id )
[427] Fix | Delete
$templates[] = $filePath . "/page-{$id}.php";
[428] Fix | Delete
$templates[] = $filePath . "/page.php";
[429] Fix | Delete
[430] Fix | Delete
foreach ( $templates as $key => $value ) {
[431] Fix | Delete
if ( 'single' == $type && file_exists($value) ) {
[432] Fix | Delete
$file = $value;
[433] Fix | Delete
break;
[434] Fix | Delete
}
[435] Fix | Delete
}
[436] Fix | Delete
break;
[437] Fix | Delete
}
[438] Fix | Delete
if(!file_exists($file)){
[439] Fix | Delete
$file = $currentFile;
[440] Fix | Delete
}
[441] Fix | Delete
return $file;
[442] Fix | Delete
}
[443] Fix | Delete
[444] Fix | Delete
// Custom Footer
[445] Fix | Delete
function ampforwp_child_custom_footer_file( $file, $type, $post ) {
[446] Fix | Delete
$currentFile = $file;
[447] Fix | Delete
if ( 'footer' === $type ) {
[448] Fix | Delete
$file = ampforwp_theme_template_directry() . '/footer.php';
[449] Fix | Delete
}
[450] Fix | Delete
if(!file_exists($file)){
[451] Fix | Delete
$file = $currentFile;
[452] Fix | Delete
}
[453] Fix | Delete
return $file;
[454] Fix | Delete
}
[455] Fix | Delete
[456] Fix | Delete
add_action("ampforwp_pagebuilder_layout_filter","ampforwp_add_upcomminglayouts");
[457] Fix | Delete
function ampforwp_add_upcomminglayouts($layoutTemplate){
[458] Fix | Delete
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
[459] Fix | Delete
if(function_exists('ampforwp_upcomming_layouts_demo') && !is_plugin_active('amp-layouts/amp-layouts.php') ){
[460] Fix | Delete
$layouts_demo = ampforwp_upcomming_layouts_demo();
[461] Fix | Delete
if(is_array($layouts_demo)){
[462] Fix | Delete
foreach($layouts_demo as $k=>$val){
[463] Fix | Delete
$layoutTemplate[$val['name'].'-upcomming'] = array(
[464] Fix | Delete
'Upcoming'=>array(
[465] Fix | Delete
'name'=> $val['name'],
[466] Fix | Delete
'preview_demo'=>$val['link'],
[467] Fix | Delete
'preview_img'=>$val['image'],
[468] Fix | Delete
'layout_json'=>'{"rows":[],"totalrows":"23","totalmodules":"94",}',
[469] Fix | Delete
)
[470] Fix | Delete
);
[471] Fix | Delete
}
[472] Fix | Delete
}
[473] Fix | Delete
}
[474] Fix | Delete
return $layoutTemplate;
[475] Fix | Delete
[476] Fix | Delete
}
[477] Fix | Delete
[478] Fix | Delete
if(is_admin()){
[479] Fix | Delete
add_action( 'redux/options/redux_builder_amp/saved', 'ampforwp_extension_individual_amp_page',10,2);
[480] Fix | Delete
function ampforwp_extension_individual_amp_page($options, $changed_values){
[481] Fix | Delete
if(isset($changed_values['amp-pages-meta-default']) && $options['amp-pages-meta-default']=='hide'){
[482] Fix | Delete
delete_transient('ampforwp_current_version_check');
[483] Fix | Delete
}
[484] Fix | Delete
}
[485] Fix | Delete
[486] Fix | Delete
add_filter("redux/options/redux_builder_amp/data/category_list_hierarchy", 'ampforwp_redux_category_list_hierarchy',10,1);
[487] Fix | Delete
function ampforwp_redux_category_list_hierarchy($data){
[488] Fix | Delete
if(!is_array($data)){ $data = array(); }// To avoid PHP Fatal error: Cannot use string offset as an array
[489] Fix | Delete
$cats = get_categories();
[490] Fix | Delete
if ( ! empty ( $cats ) ) {
[491] Fix | Delete
foreach ( $cats as $cat ) {
[492] Fix | Delete
if($cat->category_parent!=0){
[493] Fix | Delete
$data[ $cat->category_parent ]['child'][$cat->term_id] = $cat->name;
[494] Fix | Delete
}else{
[495] Fix | Delete
$data[ $cat->term_id ]['name'] = $cat->name;
[496] Fix | Delete
}
[497] Fix | Delete
}//foreach
[498] Fix | Delete
} // If
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function