the_content EMPTY
-
This plugin, once installed, returns an empty string when calls a filter hook named “the_content”.
This is not good and has brought problems with other plugins. I had to disable it even if I really like.
Viewing 2 replies - 1 through 2 (of 2 total)
-
The code will strip the content if the get_the_author_meta(‘bitcoin’) does not exist
ORIGINAL:
/* Add BitMate Donation Box After Posts */ add_filter( 'the_content', 'bm_author_donation_box' ); function bm_author_donation_box($content) { $display_options = get_option( 'bitmate_author_donations_display_options' ); if( isset( $display_options['display_bm_post_box'] ) && $display_options[ 'display_bm_post_box' ] && !is_page() ) { $bm_site_name = get_bloginfo( 'name' ); $bm_author_name = get_the_author_meta( 'display_name' ); $bm_post_url = get_permalink(); $bm_author_bitcoin = get_the_author_meta( 'bitcoin' ); $bm_author_donate_url = 'bitcoin:'. $bm_author_bitcoin.'?label=Donation-from%3A'. urlencode($bm_post_url) .'&message=Donation-from%3A'. urlencode($bm_post_url) .''; if( isset( $display_options['display_bm_author_credit'] ) && $display_options[ 'display_bm_author_credit' ] ) { $bm_author_credit = '<br/><small class="bitmate-author-credit"><a href="http://bitmate.net/author-donations/" rel="nofollow" class="bitmate-author-credit">Powered by BitMate Author Donations</a></small>'; } else { $bm_author_credit = ''; } $bm_donation_box=' <div class="bitmate-author-donation"> <div class="bitmate-author-scan"> <a href="'.$bm_author_donate_url.'" title="Scan to Donate Bitcoin to '.$bm_author_name.'"><img src="http://chart.googleapis.com/chart?chs=150x150&cht=qr&chld=H|0&chl='.$bm_author_donate_url.'" alt="Scan to Donate Bitcoin" /></a> </div> <div class="bitmate-author-description"> <strong>Ti piace?</strong> Donata Bitcoin a <a href="'. get_author_posts_url( get_the_author_meta( 'ID' ) ) .'" title="'. $bm_author_name .'" rel="author">'. $bm_author_name .'</a> : <br/> <a href="'.$bm_author_donate_url.'" title="Donate Bitcoin to '. $bm_author_name .'"><img src="'.plugins_url( 'images/bitcoin.png' , __FILE__ ).'" alt="Bitcoin" /> <strong>'. $bm_author_bitcoin .'</strong></a></a> <br/> <a href="'.$bm_author_donate_url.'" title="Donate Bitcoin to '.$bm_author_name.'"><img src="'.plugins_url( 'images/donate.png' , __FILE__ ).'" alt="Donate" class="bitmate-author-donate-button"/></a> '. $bm_author_credit .' </div> </div> '; if ( get_the_author_meta( 'bitcoin' ) ) { return $content.= ($bm_donation_box); } } else { return $content; } }FIX:
/* Add BitMate Donation Box After Posts */ add_filter( 'the_content', 'bm_author_donation_box' ); function bm_author_donation_box($content) { $display_options = get_option( 'bitmate_author_donations_display_options' ); if( isset( $display_options['display_bm_post_box'] ) && $display_options[ 'display_bm_post_box' ] && !is_page() ) { $bm_site_name = get_bloginfo( 'name' ); $bm_author_name = get_the_author_meta( 'display_name' ); $bm_post_url = get_permalink(); $bm_author_bitcoin = get_the_author_meta( 'bitcoin' ); $bm_author_donate_url = 'bitcoin:'. $bm_author_bitcoin.'?label=Donation-from%3A'. urlencode($bm_post_url) .'&message=Donation-from%3A'. urlencode($bm_post_url) .''; if( isset( $display_options['display_bm_author_credit'] ) && $display_options[ 'display_bm_author_credit' ] ) { $bm_author_credit = '<br/><small class="bitmate-author-credit"><a href="http://bitmate.net/author-donations/" rel="nofollow" class="bitmate-author-credit">Powered by BitMate Author Donations</a></small>'; } else { $bm_author_credit = ''; } $bm_donation_box=' <div class="bitmate-author-donation"> <div class="bitmate-author-scan"> <a href="'.$bm_author_donate_url.'" title="Scan to Donate Bitcoin to '.$bm_author_name.'"><img src="http://chart.googleapis.com/chart?chs=150x150&cht=qr&chld=H|0&chl='.$bm_author_donate_url.'" alt="Scan to Donate Bitcoin" /></a> </div> <div class="bitmate-author-description"> <strong>Ti piace?</strong> Donata Bitcoin a <a href="'. get_author_posts_url( get_the_author_meta( 'ID' ) ) .'" title="'. $bm_author_name .'" rel="author">'. $bm_author_name .'</a> : <br/> <a href="'.$bm_author_donate_url.'" title="Donate Bitcoin to '. $bm_author_name .'"><img src="'.plugins_url( 'images/bitcoin.png' , __FILE__ ).'" alt="Bitcoin" /> <strong>'. $bm_author_bitcoin .'</strong></a></a> <br/> <a href="'.$bm_author_donate_url.'" title="Donate Bitcoin to '.$bm_author_name.'"><img src="'.plugins_url( 'images/donate.png' , __FILE__ ).'" alt="Donate" class="bitmate-author-donate-button"/></a> '. $bm_author_credit .' </div> </div> '; if ( get_the_author_meta( 'bitcoin' ) ) { return $content.= ($bm_donation_box); } } return $content; }Thanks to the author of the fix (Dion), creator of BRIDGEDD http://bridgedd.com/
Thanks for sharing your results. I’ve actually implemented the fix in a slightly different way and everything should work as expected in the latest version and has been tested to WP 4.7.
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘the_content EMPTY’ is closed to new replies.