|
|
|
|
Thread title: About Wordpress widgets? |
|
|
|
|
|
Thread tools
Search this thread
Display Modes
|
|
01-07-2011, 05:57 AM
|
#1
|
Status: Member
Join date: Mar 2010
Location:
Expertise:
Software:
Posts: 177
|
About Wordpress widgets?
So, I put an Adsense ad unit on the sidebar of my Wordpress blog as a widget. I want the ad unit appear only on the index page, and not on single posts. You can do it on Joomla, but I don't see such a feature on Wordpress. Any suggestion?
|
|
01-07-2011, 08:55 AM
|
#2
|
Status: Junior Member
Join date: Nov 2010
Location:
Expertise:
Software:
Posts: 49
|
I believe I have done this before. There is a syntax in the HTML that determines whether the page to be displayed is a single page or an index page. Find the container for the portion of the page where you want the ad to appear and insert the Adsense code there; but put the code inside the conditional syntax.
|
|
01-07-2011, 02:38 PM
|
#3
|
Status: Request a custom title
Join date: Apr 2007
Location: UK
Expertise: Code & Programming
Software: Coda, TextMate, Sublime 2
Posts: 2,097
|
|
|
01-07-2011, 03:08 PM
|
#4
|
Status: OG
Join date: Apr 2006
Location: California
Expertise: Design, Music, Xhtml, Css
Software: Photoshop, Coda, FL Studio
Posts: 2,007
|
Originally Posted by Gaz
|
Thanks, that'll probably be use full to me one day.
|
|
01-08-2011, 05:18 PM
|
#5
|
Status: Member
Join date: Mar 2010
Location:
Expertise:
Software:
Posts: 177
|
Wow, thanks so much Gaz and Mac. I will put the Adsense ad that way. I think it's simpler than using a widget. Do you think it will make the page load faster also?
|
|
01-08-2011, 06:54 PM
|
#6
|
Status: #pugs {display: block;}
Join date: Jan 2007
Location: Chicago
Expertise: CSS, HTML, PHP
Software: Sublime Text 2
Posts: 1,187
|
You really won't notice between a widget and/or hard code truth be told. It all depends on how the rest of your WordPress blog is optimized.
|
|
01-08-2011, 09:08 PM
|
#7
|
Status: Request a custom title
Join date: Apr 2007
Location: UK
Expertise: Code & Programming
Software: Coda, TextMate, Sublime 2
Posts: 2,097
|
Except for the fact that if you have lots of sidebars defined it is easier to move them around for the less PHP/hard code inclined..
|
|
01-09-2011, 07:07 AM
|
#8
|
Status: #pugs {display: block;}
Join date: Jan 2007
Location: Chicago
Expertise: CSS, HTML, PHP
Software: Sublime Text 2
Posts: 1,187
|
Originally Posted by Gaz
Except for the fact that if you have lots of sidebars defined it is easier to move them around for the less PHP/hard code inclined..
|
That has nothing to do with load time for pages using hardcode sidebars vs widgets (specifically just the conditional sidebars.)
Of course moving/customizing a widget is going to be easier and more efficient than hardcode.
|
|
01-09-2011, 10:03 AM
|
#9
|
Status: Junior Member
Join date: Nov 2010
Location:
Expertise:
Software:
Posts: 49
|
Right, a widget is designed to make the template more user-friendly. But for those who can at least see what the codes mean and not mean (like the conditional code above), then editing the template directly should work.
Just remember, it's one thing to know the code. It's another thing to know where to place them. That's why I mentioned "containers" in my earlier post. A little live experiment should do the trick.
|
|
01-09-2011, 06:43 PM
|
#10
|
Status: Member
Join date: Mar 2010
Location:
Expertise:
Software:
Posts: 177
|
Yeah using widgets maybe easier but personally I prefer to hardcode than to use widgets. There are places where you can't put specific content (like ads) on using widgets.
|
|
|
|
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
|
|