How best to inject ads between posts in the loop?

Probably just add a counter, show ad on multiples of 6. Something like $count = 0; $adEvery = 6; if (have_posts()) : while (have_posts()) : the_post(); // Individual Post $count++; if ($count%$adEvery == 0) { // your ad } endwhile; else : // No Posts Found endif;

Custom database table for plugin not creating on activation

Here’s an updated version of pf_rb_install(). In the table creation SQL, $table_name should not be in quotes. The quotes should have triggered an error which would appear in PHP’s error.log file. Also, there should be two spaces after the PRIMARY KEY (id) portion of the SQL statement. register_activation_hook( __FILE__, ‘pf_rb_install’ ); function pf_rb_install() { global … Read more

Dynamic data in `wp_register_script` needed

You are looking for the wp_localize_script() function. This function allows you to add data from server to your javascript. However, this will not change the content of jsfile.js. Instead, it will add some global variable in your theme’s footer.Changing the content of a JS file before outputting it to the browser is an advanced technique, … Read more