Skip to content

Instantly share code, notes, and snippets.

@idavinder
idavinder / Adsense ads below post cotents in Genesis
Last active December 11, 2015 04:39
Adsense ads After post cotents in Genesis Theme
//* New Widget area to show ads after post content | basicwp.com/add-adsense-ads-genesis-single-posts/
genesis_register_sidebar( array(
'id' => 'ad-after-content',
'name' => __( 'Ad After Content Area', 'custom' ),
'description' => __( 'This is Ad section after the post content area', 'custom' ),
) );
//* Show ads after post content area
add_action( 'genesis_entry_footer', 'basicwp_ad_after_content', 2 );
function basicwp_ad_after_content() {
@idavinder
idavinder / Widget area on Homepage
Created April 27, 2013 12:12
Add new Widget are on homepage under the header
/** Add new widget under header on homepage in Genesis theme | basicwp.com/add-new-widget-genesis-homepage/ */
genesis_register_sidebar( array(
'id' => 'homepage-feature',
'name' => __( 'Homepage Feature', 'custom' ),
'description' => __( 'This is Homepage feature section', 'custom' ),
) );
/** Top Homepage feature section */
add_action( 'genesis_after_header', 'news_homepage_feature', 9 );
<form action="<?php bloginfo('url'); ?>" method="get">
<?php wp_dropdown_pages('include=532,389,417,450,472,510,502,520 &selected=532'); ?>
<input type="submit" name="submit" value="Click here" />
</form>
@idavinder
idavinder / Big Twitter follow button with followers count
Last active December 17, 2015 04:48
Big Twitter follow button with followers count
<a href="https://twitter.com/basicwp" class="twitter-follow-button" data-show-count="true" data-size="large">Follow @basicwp</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
@idavinder
idavinder / Small Twitter follow button without followers count
Created May 10, 2013 05:43
Small Twitter follow button without followers count
<a href="https://twitter.com/basicwp" class="twitter-follow-button" data-show-count="false" data-size="medium">Follow @basicwp</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
@idavinder
idavinder / Big Twitter follow button without followers count
Created May 10, 2013 05:45
Big Twitter follow button without followers count
<a href="https://twitter.com/basicwp" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @basicwp</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
@idavinder
idavinder / Small Twitter followers button with followers count
Created May 10, 2013 05:46
Small Twitter followers button with followers count
<a href="https://twitter.com/basicwp" class="twitter-follow-button" data-show-count="true" data-size="medium">Follow @basicwp</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
@idavinder
idavinder / Change attachment display settings in WordPress
Last active September 29, 2023 22:55
Change attachment display setting defaults for media in WordPress
/** set default settings of attachment media box - basicwp.com */
function attachment_default_settings() {
update_option('image_default_align', 'left' );
update_option('image_default_link_type', 'custom' );
update_option('image_default_size', 'large' );
}
add_action('after_setup_theme', 'attachment_default_settings');
@idavinder
idavinder / Disable Adsense on specific posts in WordPress
Last active December 22, 2015 15:49
Disable Adsense on specific posts in WordPress
//add this to header.php file, also change 82959, 82960 post ids or add more in the code
//http://www.basicwp.com/block-adsense-ads-on-specific-posts/
<?php Global $ad_flg; $ad_flg=1; ?>
<?php $adsense_blck_post = array(82959, 82960); ?>
<?php if (in_array($post->ID,$adsense_blck_post,true)) $ad_flg=0; ?>
//add this on single.php where adsense ad is displayed
<?php Global $ad_flg; if($ad_flg!=0) { ?>
@idavinder
idavinder / Remove Footer widgets Genesis Home
Created February 10, 2014 14:15
Remove Footer Widgets only from Genesis Homepage