Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Loop Issues results in Multiple Log Into Patreon Sections

$
0
0

Replies: 0

I modified /classes/patreon_frontend.php and added the following code inside the if hide content loop because my theme uses the_content to render the header and footer. That caused the patreon button to appear multiple times on the page and looked bad.

The original code was:

if ( $client_id ) {

	$content = self::displayPatreonCampaignBanner( $patreon_level, $lock_or_not );
	$content = apply_filters( 'ptrn/post_content', $content, $patreon_level, $user_patronage, $lock_or_not );

	return $content;

}

It is now:

if ( $client_id ) {

	// Make sure only the main content loop is modified
	if ( is_singular() && is_main_query() && !in_the_loop() ) {
		return $content;
	}

	$content = self::displayPatreonCampaignBanner( $patreon_level, $lock_or_not );
	$content = apply_filters( 'ptrn/post_content', $content, $patreon_level, $user_patronage, $lock_or_not );

	return $content;

}

Viewing all articles
Browse latest Browse all 59525

Trending Articles