- This topic is empty.
-
AuthorPosts
-
December 19, 2010 at 2:55 pm #31045PreeminentParticipant
Hey all,
I have a problem and I’m sure it’s a very simple fix. I have one page of my wordpress site that needs to have a different logo image than the rest of the site. It’s working fine, except it’s also bringing in the default logo as well. I’ve been playing around with if/else statements and conditional tags, but cannot wrap my head around how to get this to work. I really don’t know any php, I’ve used just what I’ve seen from tutorials. Here is what I currently have:As you can see, when you are on the “STORE” template page, I need that “preemplateslogo.png” logo to display, which it is doing perfectly, but I now need to customize the rest of this code (that came with the theme I’m using). What’s happening though, is the default, regular “bloglogo.png” logo is also showing up right next to the “preemplateslogo.png” logo. How do I edit this, so that only the top statement is utilized on the “STORE” template page. I hope this makes sense to you all! Thanks!
December 19, 2010 at 4:33 pm #69499clokey2kParticipantDecember 20, 2010 at 4:09 am #69424clokey2kParticipantoops, revert back for the time being, hopefully someone else will give it a go. :-)
December 24, 2010 at 2:43 am #68873BobMember
The above code worked for me, although I simplified it a bit using my own images and removing the bloginfo(‘url’) and such so you should put that back. It should still work then however.
January 1, 2011 at 8:41 am #68022BobMemberThe
$var==1
and$var==2
was just an example for me to be able to test it locally, ’cause if I used is_page_template(‘store.php’), it wouldn’t work for me since I obviously don’t have that page template here on my computer.Can you post your code like you have it now? Or did you not modify it at all? The code I posted above worked fine for me like I said, but you have to adapt it to fit your needs like I said. Thus, replace
if ( $var==1 )
withif (is_page_template('store.php'))
and so on.
Basically, from what I see, the if..elseif..else statements I created should work; you just have to adapt it to your own code, so please post back what you have now.January 1, 2011 at 1:37 pm #67873BobMemberOk, check out the following code:
if ( is_page_template('store.php') )
{ ?>
">
$customField1 = get_option("theme_logo");
elseif ( isset($customField1[0]) )
{ ?>
">
else
{ ?>
">
I’ve adapted it so it should fit your needs exactly. I put back in your links to your images etc.
Try this code to see if it works, and if it doesn’t, post back why it isn’t working.January 3, 2011 at 7:49 am #67734BobMemberCan you please post the whole error it is giving?
January 4, 2011 at 4:16 am #67671clokey2kParticipantI think you have broken the ‘if’ statement when running:
$customField1 = get_option("theme_logo");
Maybe set that before the main ‘if’?
January 5, 2011 at 9:15 am #67494BobMemberHmm, that is odd. Try removing the line:
$customField1 = get_option("theme_logo");
And replacing the line:
elseif ( isset($customField1[0]) )
with the line:
elseif( is_page_template('templatnamehere.php') )
Replace templatenamehere with another template you have, just make sure its different from store.php ’cause thats already being used in the first if statement so you wouldn’t see any difference then. Its just for testing purposes so either create a test template and use that in the above elseif statement or use an other template you have.
See if that helps.January 6, 2011 at 2:52 am #67312BobMemberGlad to hear its working.
But hang on, if you leave it like that, you do realize the
, which belongs to the
elseif ( is_page_template('TESTtemplate.php' ) )
, will never show up right? If you’re ok with that, I’m glad because that means its working for you, but if you don’t mind it showing up at all, why did you add an if statement for it in the first place (see your first post)? Don’t you need the image to show sometime?January 7, 2011 at 6:30 am #67257 -
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.