RSS feed validity and Google Adsense

Do not paste the Adsense code into the blog posts. Use a plugin instead. Sample Plugin: <?php /* Plugin Name: Zoomingjapan Adsense */ add_filter( ‘the_content’, ‘zoomingjapan_adsense’ ); function zoomingjapan_adsense( $content ) { if ( is_feed() or ! is_singular() ) return $content; $adsense=”<adense code, replace that!>”; // remove all existing script elements $content = preg_replace(“~<script[^>]*>.+</script[^>]*>~i”, ”, … Read more

Block Adsense on specific page

You can use this function: <?php if(is_page(‘your-page-slug’)): ?> //do nothing on selected pages <?php else: ?> <script async src=”https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js” /> <script> </script> <?php endif; ?> If you want to disable this on more than one page, just add them like this: <?php if(is_page(‘your-page-slug1’) || is_page(‘your-page-slug2’)): ?> WordPress Developer Resources are very useful (more than codex), … Read more

Inserting AdSense code right after tag

Without using a plugin, the WordPress way would be to use the wp_head action to insert the script and then enqueue the script file: function mytextdomain_adsense() { $output=” <script> </script>”; echo $output; } add_action(‘wp_head’,’mytextdomain_adsense’); function mytextdomain_adense_script() { wp_enqueue_script( ‘my-adsense’, ‘//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js’, array(), ‘1.0.0’, false ); } add_action( ‘wp_enqueue_scripts’, ‘mytextdomain_adense_script’ ); And to add the async attribute … Read more

Adding Google Custom Search to a Public Released Theme

You can improve it, combining Google Search and WordPress Search. using this simple javascript: function displaygoogle(checkbox){ if(checkbox.checked){ document.getElementById(“googlesearchbox”).style.display = ‘block’; document.getElementById(“wordpresssearchbox”).style.display = ‘none’; document.getElementById(“googlesearchinput”).value = document.getElementById(“wordpresssearchinput”).value; } else{ document.getElementById(“googlesearchbox”).style.display = ‘none’; document.getElementById(“wordpresssearchbox”).style.display = ‘block’; document.getElementById(“wordpresssearchinput”).value = document.getElementById(“googlesearchinput”).value; } } see more detail here: http://jaider.net/2011-05-08/how-to-combine-google-wordpress-search/

Offering Ads Dependent on Visitor Type?

There are systems that do something similar, particularly for Example 2. What Would Seth Godin Do, for example, stores a cookie in the user’s browser that tracks the number of times they’ve visited the site. If they’re a new visitor (have visited less than 5 times), it displays a message suggesting they subscribe to the … Read more

Adding ads after a certain number of paragraphs within Genesis themework

I’ve found explode() to be useful when trying to break strings apart. This code creates an array of paragraph chunks, inserts the new block after two paragraphs and concatenates it back into a string for output. function insert_ad_block( $text ) { if ( is_single() ) : $ads_text=”<div class=”wpselect_middle_content”>My Ad Code Here</div>”; $split_by = “\n”; $insert_after … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)