Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Wordpress - how to make 2 different logos - one on some pages one on others

Posted on 2013-06-12
8
Medium Priority
?
269 Views
Last Modified: 2013-09-18
Here is the website. Trying to make two logos appear. One on a few pages, and another on other pages?

http://www.ronhenrey.com/welcome/
0
Comment
Question by:angelic_webmaster
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
8 Comments
 
LVL 25

Assisted Solution

by:James Rodgers
James Rodgers earned 400 total points
ID: 39244305
take a look here
http://codex.wordpress.org/Function_Reference/is_page
this will let you set up an if to determine which page you are on and show the logo accordingly
0
 
LVL 17

Accepted Solution

by:
jrm213jrm213 earned 1600 total points
ID: 39253331
I would recommend doing this all through the wordpress functionality and then just making one change to the header.php page so that you can specify what logo to display when creating/editing a wordpress page.

In your header.php replace your img tag for the logo with the following.
<?php
$logoImg = get_post_meta(get_the_ID(),'logo-image');
try
{
	$logoImg = $logoImg[0];
}
catch (Exception $e)
{
	$logoImg = "/wp-content/images/uploads/default-logo.png"; //place a default image here for pages that don't have it set
}
?>
	<img src="<?php	echo $logoImg;?>" alt="Logo"/>

Open in new window


then in your pages add a "Custom Field" named "logo-image" and add the path and image name for the value.


this way you don't have to edit an "if is_page()" block or case statement every time you add a page, and you could display any image you wanted there.
0
 

Author Comment

by:angelic_webmaster
ID: 39264145
Ok I will try these both and let you know.
My father passed away this last week so I have not been able to respond.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:angelic_webmaster
ID: 39299292
Would this still work on my new template I am using.
<?php
$logoImg = get_post_meta(get_the_ID(),'logo-image');
try
{
	$logoImg = $logoImg[0];
}
catch (Exception $e)
{
	$logoImg = "/wp-content/images/uploads/default-logo.png"; //place a default image here for pages that don't have it set
}
?>
	<img src="<?php	echo $logoImg;?>" alt="Logo"/>

Open in new window


www.ronhenrey.com
0
 
LVL 17

Expert Comment

by:jrm213jrm213
ID: 39304603
re: post 39299292

Yes that should still work.
If you have a custom field  named "logo-image" on a page it should display that image. If you don't have that custom field on a page, it will display the default image.
0
 

Author Closing Comment

by:angelic_webmaster
ID: 39504168
Thank you all for helping me. The code was great - although I went a different route :)
0

Featured Post

Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question