Skip to content

Commit

Permalink
move function
Browse files Browse the repository at this point in the history
  • Loading branch information
u451f committed Jul 16, 2017
1 parent a51659b commit db43e23
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions error_code_451.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,15 @@ function alter_censored_content( $content ) {
return $content;
}

// hide the blocked post thumbnail.
function alter_censored_thumbnail( $html, $post_id, $post_thumbnail_id, $size, $attr) {
global $post;
if($post AND compare_post_with_location($post->ID)) {
$html = "";
}
return $html;
}

function compare_post_with_location($post_id) {
global $cfg;
$blocked_content_ids = read_json($cfg['json_filename']);
Expand All @@ -150,15 +159,6 @@ function compare_post_with_location($post_id) {
return false;
}

// hide the blocked post thumbnail.
function alter_censored_thumbnail( $html, $post_id, $post_thumbnail_id, $size, $attr) {
global $post;
if($post AND compare_post_with_location($post->ID)) {
$html = "";
}
return $html;
}

// add the filter when main loop starts
add_action( 'loop_start', function( WP_Query $query ) {
if ($query->is_archive() || $query->is_feed() || $query->is_home() || $query->is_search() || $query->is_tag() && $query->is_main_query()) {
Expand Down

0 comments on commit db43e23

Please sign in to comment.