Skip to content

Commit

Permalink
#2512 Code improvements to avoid errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MARQAS committed Oct 3, 2018
1 parent f3518e3 commit 3f33010
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
17 changes: 17 additions & 0 deletions accelerated-moblie-pages.php
Expand Up @@ -817,4 +817,21 @@ function register_widgets() {
unregister_widget( $registered_widget_class_name );
register_widget( $amp_class_name );
}
}
// Post Types
function ampforwp_get_all_post_types(){
global $redux_builder_amp;
$post_types = array();
$selected_post_types = array();

$post_types = array('post' => 'post', 'page' => 'page');
if ( isset($redux_builder_amp['ampforwp-custom-type']) && $redux_builder_amp['ampforwp-custom-type'] ) {

foreach ($redux_builder_amp['ampforwp-custom-type'] as $key) {
$selected_post_types[$key] = $key;
}
$post_types = array_merge($post_types, $selected_post_types);
}

return $post_types;
}
2 changes: 1 addition & 1 deletion components/loop/loop.php
Expand Up @@ -95,7 +95,7 @@ function call_loops_standard($data=array()){
'has_password' => false ,
'post_status'=> 'publish'
);
if ( is_category() || is_taxonomy($qobj->taxonomy) ) {
if ( is_category() || ( isset($qobj->taxonomy) && taxonomy_exists($qobj->taxonomy)) ) {
$args['tax_query'] = array(
array(
'taxonomy' => $qobj->taxonomy,
Expand Down
17 changes: 0 additions & 17 deletions includes/features/functions.php
Expand Up @@ -263,23 +263,6 @@ function ampforwp_generate_meta_desc($json=""){
return $desc;
}

function ampforwp_get_all_post_types(){
global $redux_builder_amp;
$post_types = array();
$selected_post_types = array();

$post_types = array('post' => 'post', 'page' => 'page');
if ( isset($redux_builder_amp['ampforwp-custom-type']) && $redux_builder_amp['ampforwp-custom-type'] ) {

foreach ($redux_builder_amp['ampforwp-custom-type'] as $key) {
$selected_post_types[$key] = $key;
}
$post_types = array_merge($post_types, $selected_post_types);
}

return $post_types;
}

// 77. AMP Blog Details
if( !function_exists('ampforwp_get_blog_details') ) {
function ampforwp_get_blog_details( $param = "" ) {
Expand Down

0 comments on commit 3f33010

Please sign in to comment.