Community Forums › Forums › Archived Forums › Design Tips and Tricks › I want to place ad code below the header in Magzine theme
- This topic has 16 replies, 4 voices, and was last updated 8 years, 12 months ago by
Ryan Kennedy.
-
AuthorPosts
-
July 18, 2014 at 10:55 pm #114887
Ryan Kennedy
MemberHello,
Where can I place my adsense HTML code in order for it to appear below the header in the magazine theme? I don't know how to access the HTML code for my theme.
any help is greatly appreciated.
Thanks in advance.
http://www.stylefeels.com/July 18, 2014 at 11:20 pm #114891Genesis Developer
Memberuse
genesis_after_header
hook . See Code snippet hre http://gregrickaby.com/genesis-code-snippets/
July 19, 2014 at 10:47 am #114927DTHkelly
MemberCreate a widget area and hook it as genwrock indicated. Drag a text widget into this widget area. Paste HTML in the text widget.
http://www.carriedils.com/add-widget-area-below-nav/
Although this tutorial addresses Calls to action,the hook is the same you needadd_action( 'genesis_after_header', 'mp_cta_genesis' );{
Change
mp_cta_genesis
to the name of your custom adsense widget area after header. Also line 5
function mp_cta_genesis() {
Not your desired hook, but some additional reference:
http://wpselect.com/add-google-adsense-to-genesis-framework-theme/
http://www.bitdoz.com/1637/add-custom-widgets-advertisements-genesis-framework/
http://sridharkatakam.com/display-google-ad-primary-sidebar-widgets-genesis/Hope this helps!
July 20, 2014 at 6:48 am #115025Brad Dalton
ParticipantAdd a new widget would be easiest http://wpsites.net/web-design/adding-new-widget-areas-in-studiopress-themes/
October 1, 2014 at 10:17 am #126441Ryan Kennedy
MemberThanks for all the help. I've successfully added a new widget area. The problem I'm having is editing the functions.php so that the new widget are show up on all pages all the time just like the header. I messed around with the conditional tags but I'm not to confident what code to use.
Any help is greatly appreciated
@braddalton your site is very helpfulOctober 1, 2014 at 6:35 pm #126485Brad Dalton
ParticipantOctober 3, 2014 at 7:01 pm #126715Ryan Kennedy
MemberThe problem I’m having is editing the functions.php so that the new widget are show up on all pages all the time just like the header. I messed around with the conditional tags but I’m not to confident what code to use. Can you point me in the right direction?
October 3, 2014 at 7:33 pm #126719Brad Dalton
ParticipantJust remove the conditional tags and one of the closing brackets.
October 3, 2014 at 7:41 pm #126720Ryan Kennedy
MemberCan you show me perhaps?
genesis_register_sidebar( array(
'id' => 'new-widget',
'name' => __( 'New Widget', 'domain' ),
'description' => __( 'Add Content Here', 'domain' ),
) );add_action( 'genesis_after_header', 'your_widget' );
function your_widget() {
if ( is_home() && is_active_sidebar('new-widget') ) {
genesis_widget_area( 'new-widget', array(
'before' => '<div class="new-widget widget-area">',
'after' => '</div>',
) );}
}
October 3, 2014 at 8:00 pm #126724Ryan Kennedy
MemberCan you explain what I need to remove a little more in depth?
October 3, 2014 at 8:08 pm #126726Brad Dalton
ParticipantOctober 3, 2014 at 8:12 pm #126727Ryan Kennedy
MemberThat messes up my whole page from loading for some reason. ?
October 3, 2014 at 8:20 pm #126728Brad Dalton
ParticipantIf you embed the code incorrectly in a web page and then someone copies and pastes it, it will break their site.
The line i refer to should now look like this:
if ( is_active_sidebar('new-widget') ) {
Grab the code from the Gist and try again please using a code editor like Notepad++.
October 3, 2014 at 8:30 pm #126730Ryan Kennedy
MemberI really appreciate your help.
When I made the correction to the code in text wrangler and entered it into the function.php my site loaded fine however the widget area did not show up anywhere except on the widget page.
October 3, 2014 at 9:01 pm #126732Brad Dalton
ParticipantYou will need to populate the widget area for it to display something on the front end Ryan.
October 4, 2014 at 9:29 am #126760Ryan Kennedy
MemberYes I have advertising code in the widget area and It does show up on the front page with the original code from your site, however when I remove is_home() && conditional tag it then doesn't show on any page. Is there something else I am missing or another way to go about it. I also tried to set the visibility in the widget section also.
October 4, 2014 at 9:39 am #126761Ryan Kennedy
MemberOk, I gave it another try and it is working correctly. I greatly appreciate your help. Let me know how I can repay you.
Thanks a lot
Ryan
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.