1

Update: I tried to change the code in the logo.php file to link to a new logo image that's stored in the Media Library. Following is the code I used, but it's not finding the logo file.

<h1 id="logo" class="initial ppb">
    <a href="<?php echo home_url(); ?>">
        <img src="<?php echo plugin_dir_url( __FILE__ ); ?>wp-content/uploads/2018/05/prettypleasedesign-logo.png" alt="Pretty Please Baby" />
    </a>
</h1>

I'm pretty sure I know what's wrong — the code is saying to look in the plugin directory for the image, not the Media Library. But I don't know the correct code to use.

(I'm trying to do it this way, rather than uploading the new logo image via FTP to the plugin's folder, because I don't currently have access to the client's web host to use FTP.)

I'll keep googling for the correct code, but if anyone wants to jump in with the correct code, I'd appreciate it!

— — —

How do I replace a logo image that’s hard-coded into a plugin’s logo.php file? Please see the attached screenshots.

  • Can I upload the new logo image to the Media Library and then replace “prettypleasebaby.jpg” in the logo.php file with the link to the new logo in the Media Library?

  • Or do I need to upload the new logo image via FTP to the plugin’s folder, and then change “prettypleasebaby.jpg” in the logo.php file to reference the new logo?

I'd just experiment and try to figure it out, but I'm doing this for someone else and want to be cautious not to cause any php errors.

I appreciate any help with this!

Amber

logo image code via Inspect Element

logo image coded into logo.php file

2 Answers 2

1

The plugin looks like it’s specific to the site, and not in danger of being updated by WordPress, so you can change the plugin’s code without much fear of losing it. Either option you mentioned will be fine, though I recommend the second option, to keep things together.

Typically the theme would be in charge of appearances: not sure why the plugin is handling it.

3
  • 1
    Ok, thank you! Apparently the plugin was developed in order to have a custom post archive template that displayed a different logo than the rest of the site. Just curious, if you feel like answering… Would there be a way to develop a custom post archive template that displays a different logo than the rest of the site, but not have the logo hard-coded into the plugin’s logo.php file? (I’m more a designer than a developer, but I’m trying to learn more about the development side of things.)
    – amber
    Commented Jun 8, 2023 at 0:36
  • 1
    Most likely, but hard to know for sure without looking at the theme and how the plugins works.
    – Caleb
    Commented Jun 8, 2023 at 0:39
  • Ok, thanks again!
    – amber
    Commented Jun 8, 2023 at 0:51
1

Found the correct code! Here it is:

<h1 id="logo" class="initial ppb">
    <a href="<?php echo home_url(); ?>">
        <img src="<?php echo home_url(); ?>/wp-content/uploads/2018/05/prettypleasedesign-logo.png" alt="Pretty Please Baby" />
    </a>
</h1>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.