If you are using Genesis Theme Framework and would like to display Google Adsense or any advertisement code after the first post on the homepage, archives, and search results page, add the code below to the child theme’s functions.php file. add_action(‘genesis_after_post’, ‘aycchildthemes_ad_after_first_post’); function aycchildthemes_ad_after_first_post() { global $loop_counter; if (!is_singular() && $loop_counter == 0) { ?> […]
This is a simple task if you use the built in is_page() conditional tag in WordPress and use one of the Genesis structural action hooks. We’ll be using the genesis_before_sidebar_widget_area action hook in this example. <?php // Add additional sidebar content to the book page add_action(‘genesis_before_sidebar_widget_area’, ‘child_genesis_sidebar’); function child_genesis_sidebar() { if ( is_page(‘__SPECIFIC-PAGE-ID-OR-TITLE__’)) { ?> […]
There’s a lot of small code snippets I use often. This is where I’ll collect them. If you have any quick tips, feel free to share in the comments. Force a page layout This is very useful for ensuring custom pages you build for a client aren’t broken by them changing the page layout (ex: […]