Skip to content

Commit

Permalink
Fix for getting the post ID on home and archive pages
Browse files Browse the repository at this point in the history
  • Loading branch information
kinging123 committed Dec 27, 2020
1 parent 03d082c commit 3b99a07
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ivrita.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ public function print_switch() {

public function enabled_for_page( $id = null ) {
global $post;
if ( $id === null ) {
$id = $post->ID;
if ( $id === null && is_single() ) {
$id = get_the_ID();
}

// Globally enabled
if ( !$this->settings->get_field( 'enable_global' ) ) {
return false;
} else if (get_post_meta( $id, '_ivrita_post_disable', true )) {
} else if ($id && get_post_meta( $id, '_ivrita_post_disable', true )) {
return false;
}

Expand Down

0 comments on commit 3b99a07

Please sign in to comment.