Site logo

Archived topic

Remote Hosting of Logo

13 replies · Started by simit on December 12, 2019

Viewing posts 1–14 of 14

hello,

we have a situation in which we cannot host files using WP uploads, and so are relying on remote storage (i.e. AWS and google cloud storage). is there a way we can add a logo by providing a logo URL, rather than the upload logo tool provided in the theme customizer?

thanks in advance for your help!

simit

hi leo, thanks for your reply. i added the code below via the code snippets plugin. however, it doesn't seem to be working on my site (https://sixjupiter.wpengine.com). any thoughts?

add_filter( 'generate_logo_output', 'tu_logo_class', 10, 3 );
function tu_logo_class( $output, $logo_url, $html_attr ) {
	printf(
		'<div class="site-logo MY-CUSTOM-CLASS">
			<a href="%1$s" title="%2$s" rel="home">
				<img src = "https://storage.googleapis.com/sjn-charts/dfx2/cfdt-s.png">
			</a>
		</div>',
		esc_url( apply_filters( 'generate_logo_href' , home_url( '/' ) ) ),
		esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
		$html_attr
	);
}

Are you able to upload any image in the logo field in the customizer?

Looks like the filter doesn't kick in until an image is uploaded as logo.

Let me know :)

hi leo, thanks for your reply. no, we cannot rely on wp-uploads at all. basically, all image storage needs to be on AWS. any ideas?

That case we would need to add the logo manually.

Try creating a new hook element:
https://docs.generatepress.com/article/hooks-element-overview/

And add this as the content:

<div class="site-logo">
    <a href="HOME-PAGE-URL" title="SITE-TITLE" rel="home">
	<img src = "https://storage.googleapis.com/sjn-charts/dfx2/cfdt-s.png">
    </a>
</div>

Then select inside_navigation as the hook.

Let me know when this is done and we can tweak the appearance with some CSS.

i got it working, but do you know what CSS i can add to make it left-aligned and side by side with the rest of the navigation? sort of like how the logo typically appears when added via the upload utility?

Just checked the site and not seeing the logo.

Can you double check?

hi leo,

thanks for your patience and help thus far -- i really appreciate it. the changes seem to have helped a bit, but do you know how i can get logo and nav links side by side (i.e. horizontally aligned) rather than stacked atop each other? https://sixjupiter.wpengine.com/

ahh, i'm an idiot! :) thanks for your patience with me. problem is solved now. :)

No problem :)

This archived topic is closed to new replies.