Skip to content

Commit

Permalink
#2795 To remove undefined index errors and also used ampforwp_get_set…
Browse files Browse the repository at this point in the history
…ting
  • Loading branch information
MARQAS committed Jan 11, 2019
1 parent 49f9ffd commit 03b69a5
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions templates/features.php
Original file line number Diff line number Diff line change
Expand Up @@ -3707,8 +3707,8 @@ function ampforwp_posts_to_remove () {
$selected_cats = array();
$post_id_array = array();
$current_cats_ids = array();
if(isset($redux_builder_amp['hide-amp-categories2'])){
$get_categories_from_checkbox = $redux_builder_amp['hide-amp-categories2'];
if(ampforwp_get_setting('hide-amp-categories2') ) {
$get_categories_from_checkbox = ampforwp_get_setting('hide-amp-categories2');
if($get_categories_from_checkbox){
$get_selected_cats = array_filter($get_categories_from_checkbox);
foreach ($get_selected_cats as $key => $value) {
Expand All @@ -3726,7 +3726,7 @@ function ampforwp_posts_to_remove () {
}
}
if( is_array(ampforwp_get_setting('hide-amp-tags-bulk-option2'))) {
$get_tags_checkbox = array_values(array_filter($redux_builder_amp['hide-amp-tags-bulk-option2']));
$get_tags_checkbox = array_values(array_filter(ampforwp_get_setting('hide-amp-tags-bulk-option2')));
$all_tags = get_the_tags(get_the_ID());
$tagsOnPost = array();
if ( $all_tags ) {
Expand All @@ -3744,16 +3744,16 @@ function ampforwp_posts_to_remove () {
function is_category_amp_disabled(){
global $redux_builder_amp;
$current_cats_ids = array();
if(is_archive() && $redux_builder_amp['ampforwp-archive-support']==1){
if(is_tag() && is_array($redux_builder_amp['hide-amp-tags-bulk-option2'])) {
if(is_archive() && true == ampforwp_get_setting('ampforwp-archive-support') ){
if(is_tag() && is_array(ampforwp_get_setting('hide-amp-tags-bulk-option2'))){
$all_tags = get_the_tags();
$tagsOnPost = array();
if ( $all_tags ) {
foreach ($all_tags as $tagskey => $tagsvalue) {
$tagsOnPost[] = $tagsvalue->term_id;
}
}
$get_tags_checkbox = array_values(array_filter($redux_builder_amp['hide-amp-tags-bulk-option2']));
$get_tags_checkbox = array_values(array_filter(ampforwp_get_setting('hide-amp-tags-bulk-option2')));

if( count(array_intersect($get_tags_checkbox,$tagsOnPost))>0 ){
return true;
Expand All @@ -3762,10 +3762,10 @@ function is_category_amp_disabled(){
return false;
}
}//tags check area closed
if( is_category() && is_array($redux_builder_amp['hide-amp-categories2'])){
if( is_category() && is_array(ampforwp_get_setting('hide-amp-categories2'))){
$categories = get_the_category();
$selected_cats = array();
$get_categories_from_checkbox = $redux_builder_amp['hide-amp-categories2'];
$get_categories_from_checkbox = ampforwp_get_setting('hide-amp-categories2');
$get_selected_cats = array_filter($get_categories_from_checkbox);
foreach ($get_selected_cats as $key => $value) {
$selected_cats[] = $value;
Expand Down Expand Up @@ -3795,8 +3795,8 @@ function ampforwp_exclude_archive($archive = 'cat'){
return $exclude;
}
// Tags
if ( isset($redux_builder_amp['hide-amp-tags-bulk-option2']) && is_array($redux_builder_amp['hide-amp-tags-bulk-option2']) && 'tag' == $archive ) {
$exclude = array_values(array_filter($redux_builder_amp['hide-amp-tags-bulk-option2']));
if ( is_array(ampforwp_get_setting('hide-amp-tags-bulk-option2')) && 'tag' == $archive ) {
$exclude = array_values(array_filter(ampforwp_get_setting('hide-amp-tags-bulk-option2')));
return $exclude;
}
}
Expand Down Expand Up @@ -4393,6 +4393,7 @@ function ampforwp_yarpp_loop_query_for_inline_related_posts($reference_ID = null

function ampforwp_inline_related_posts(){
global $post, $redux_builder_amp;
$inline_related_posts = '';
$string_number_of_related_posts = $redux_builder_amp['ampforwp-number-of-inline-related-posts'];
$int_number_of_related_posts = (integer) $string_number_of_related_posts;

Expand Down

0 comments on commit 03b69a5

Please sign in to comment.