The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Different Logo for each wordpress page Reply To: Different Logo for each wordpress page


@melindrea Perhaps it does, i haven’t used wp in a looong time – there might even be a smarter function then the one i found somewhere i wp by default these days :)

But i find adding a single function, to get the slug, is way easier then adding multiple lines of php, especially since @danielc2384 wrote > Not really all that experience with php.

Your approach will work fine for sure, but i would rather edit my .css, to add a new .logo-slugname, then doing it in the header.php code. Especially since this would have to be edited every time a new page is added.

A shorter, none css, version of my approach could be (in header.php – functions.php still needs the function)

<img src="images/logo-<?php the_slug().png">

With this all danielc2384 would have to do is uploading the new logo-new-page-slug.png and then it should be shown automaticly.

images/logo-hello-world.png // default

edit: of course the_slug() has no fallback, so if some-page.png is missing, no logo will be displayed. If using the css, the #logo will always render the default logo and if #logo img.some-page is defined in css it will overwrite it.