go41

different image in header or sidebar by page ID

von Joern am 23. Jun. 2009 | Keine Kommentare

If you want to load different header images, banners or an image in the sidebar, you can use a simple piece of php code.
Let’s say your normal image loads like this:
<img src="<?php bloginfo(‚template_url‘); ?>/images/logo.jpg" alt="" width="900px" height="250px" />
now you replace this full img src line with this:
<?php if (is_page(‚1‘)) { ?>
<img src="<?php bloginfo(‚template_url‘); ?>/images/logo1.jpg" alt="" width="900px" height="250px" />
<?php } elseif (is_page(‚2‘)) { ?>
<img src="<?php bloginfo(‚template_url‘); ?>/images/logo2.jpg" alt="" width="900px" height="250px" />
<?php } elseif (is_page(‚3‘)) { ?>
<img src="<?php bloginfo(‚template_url‘); ?>/images/logo3.jpg" alt="" width="900px" height="250px" />
<?php } else { ?>
<img src="<?php bloginfo(‚template_url‘); ?>/images/logo.jpg" alt="" width="900px" height="250px" />
<?php } ?>
this code will load logo1.jpg when you see page ID=1, logo2 for page with id 2 etc, if not one of this pages is loaded, it will ‚else‘ switch to default logo.jpg
do not forget to put the pictures into the images folder behind your theme folder and adjust the IDs to your page ID.
____________________
you find me on Google+, Twitter and Facebook

(von: master)

Hier noch 30 weitere Ergebnisse dieses Threads:

Adding Keywords in arthemia theme

17. Mai. 2011 (von: sim_a1)

hi joern i got a lot of help from you and i really appreciate that..im here to again disturb you..i got a question regarding the theme.At my Homepage the title is tech solutions and library which i entered while installing.…

Re: Adding Keywords in arthemia theme :: Reply by Joern

17. Mai. 2011 (von: Joern)

The title tag in arthemia is generated in header.php in this line:<title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> &raquo; Blog Archive <?php } ?> <?php wp_title(); ?></title>This is a formatting used a while ago, the wp_title works…

Re: Adding Keywords in arthemia theme :: Reply by Joern

17. Mai. 2011 (von: Joern)

The Next and Previous Posts link for moving through your site control is typically found at the bottom or top of your single post.So single.php is the file to add this code.As sample you might go to:http://themes.go41.de/?wptheme=aranovo2to select a theme…

Re: Adding Keywords in arthemia theme :: Reply by sim_a1

17. Mai. 2011 (von: sim_a1)

Thank you very much for your help. It has been a great help. Thre is only on eproblem im facing now. When im trying to use custom permalink on my localhost as /%postname%/%post_id%/ but it isn't working. the pages are…

Re: Adding Keywords in arthemia theme :: Reply by Joern

17. Mai. 2011 (von: Joern)

next - previous just under the post:add the code I gave you just above<div id="comments"> <?php comments_template(); ?> </div>in single.php, it should!? appear before the comment stuffThe permalinks on a localhost:In 'Using Permalinks' on wordpress.org you can find a section…

Re: Adding Keywords in arthemia theme :: Reply by sim_a1

20. Mai. 2011 (von: sim_a1)

That was so helpfull. But i just can't figure out how to rewrite .htaccess..but im not able to do that.and also one important question i want to ask that is i change the permalink then will it affect previous links…

Re: Adding Keywords in arthemia theme :: Reply by Joern

20. Mai. 2011 (von: Joern)

about .htaccess I would say you find all details in the WordPress Codex:http://codex.wordpress.org/Using_PermalinksIf you use a ftp programm you might not see this file, as it's hidden. You have to set the prog to show hidden files...switching from Wor... Weiterlesen…

Re: Adding Keywords in arthemia theme :: Reply by sim_a1

21. Mai. 2011 (von: sim_a1)

Thanks once again for your help, i really appreciate that. I also want to thank you for reading out that article. Samsung Ace does have the gorilla glass display, you can check it here http://www.corninggorillaglass.com/featured-products. you can also ... Weiterlesen…

How do you customize „Featured post“ comments/date indicator

21. Mai. 2011 (von: omerkhan01)

Hi there, Quick question. As you can see under the featured posts, it states the date and whether comments are on or off. How do you1) Remove the comments/on/off line2) Color the date( I only want to keep this but…

Re: How do you customize „Featured post“ comments/date indicator :: Reply by Joern

22. Mai. 2011 (von: Joern)

I think you mean under your 'Featured items!' ?This should still be in index.php some lines under your div id="arthfeatured"here you have the social buttons and following this comes the loop for your featured posts.In there you find a line…

Re: How do you customize „Featured post“ comments/date indicator :: Reply by omerkhan01

22. Mai. 2011 (von: omerkhan01)

Okay but here is my question.If you click on the Media Content category, you can see how the content is in "Excerpt" format and divided by a nice read lineI want this to be the case with all other categories…

Re: How do you customize „Featured post“ comments/date indicator :: Reply by Joern

22. Mai. 2011 (von: Joern)

If I click on the Media Content category, I can see no "Excerpt" format for all posts except the last one?!Means for me there is actually no 'content' for these posts in the database.I mean reviews, sc and other posts…

Adsense Help

24. Mai. 2011 (von: sim_a1)

Hi joern.Im again here to disturb you, hope you dn't mind.I want to ask you that how do i place ad in the sidebar. The size of the ad is not getting into it. i tried placing it in the…

Re: Adsense Help :: Reply by Joern

24. Mai. 2011 (von: Joern)

actually there was on top of sidebar.php this<div id="sidebar"><div id="sidebar-ads"><img src="<?php echo get_option('home'); ?>/wp-content/themes/arthemia/images/banners/square.jpg" alt="" width="300px" height="250px" /></div><div id="sidebar-top">best place for an add is above the 'fold', so on top of the sidebar.If your sidebar looks like this, it shoold…

Re: Adsense Help :: Reply by sim_a1

25. Mai. 2011 (von: sim_a1)

it worked out. thnks for the help. and i want to add it in single.php, also i have already created three ad unit. will it be ok if i create one more for single.php Weiterlesen →

Re: Adsense Help :: Reply by Joern

25. Mai. 2011 (von: Joern)

I see the add in the upper location, but why didn't you put the div id="sidebar-ads" around? It should center the add in this place.Having one add in the header and one in the sidebar, you still can put one…

Re: Adsense Help :: Reply by sim_a1

25. Mai. 2011 (von: sim_a1)

as you suggested i tried to put "div=sidebar ads" but there was problem when i access any post. it was working only on the homepage not on any other pages. The format of the page gets misplaced.. the tag cloud…

Re: Adsense Help :: Reply by sim_a1

25. Mai. 2011 (von: sim_a1)

in addition to above question i would also like to add one more question. How can i add the description of my website. And that description should be displayed in google. Now when i search my site. the content of…

Re: Adsense Help :: Reply by Joern

25. Mai. 2011 (von: Joern)

I know this div-problem if the sidebar comes up, mostly it is because there is one /div missing in the sidebar.a new div=sidebar ads always also needs an end /div.So I hope you added something above the adsense script and…

Re: Adsense Help :: Reply by sim_a1

26. Mai. 2011 (von: sim_a1)

Thank you very much for your help. i really appreciate that. now i figured out most of the things. all i need is traffic on my site. Can you provide me some tips on how to increase views and visits.…

Re: Adsense Help :: Reply by Joern

26. Mai. 2011 (von: Joern)

All in all it just takes time to get crawled and indexed.Some hints: You gave me once the link to your site, www.abcxyz.comYour site is actually without www. For google the site with www is actually another site (subdomain) of…

Re: Adsense Help :: Reply by sim_a1

27. Mai. 2011 (von: sim_a1)

thank for the advise. But i didn;t get the Part "On your front-page the biggest text is the repeating category titles in h3, no headline or post-title is h1 or h2" and the styling. Bit confused. Hope you'll elaborate. Weiterlesen…

Re: Adsense Help :: Reply by sim_a1

29. Mai. 2011 (von: sim_a1)

also could you plz tell me how do insert ad in index.php just below the category list. Weiterlesen →

Re: Adsense Help :: Reply by master

29. Mai. 2011 (von: master)

to insert an add in index.php under the category bar you need to find this line:<div id="front-list">just directly under this line youput this code (try the add code from your header first):<div style="margin: 5px auto 10px;text-align:center;"><script type="text/javascript"><!--google_ad_client = "ca-pub-your 468x60…

Re: Adsense Help :: Reply by sim_a1

1. Jun. 2011 (von: sim_a1)

thanks for the info..was really helpful.one last question. how can i add this box as shown in the image.Social box How do i ad it on my sidebar..what is name of plugin. Weiterlesen →

Autor:

Du findest mich auch auf Twitter und Facebook!

Schreibe einen Kommentar

Pflichtfelder sind mit * markiert.


Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.

weitere forum Beiträge: