WordPress.org

Forums

How to center custom logo header image (7 posts)

  1. CaptainS82
    Member
    Posted 1 year ago #

    I’ve been searching for a while now to find others with this problem, but their solutions don’t seem to help me.
    I have the ‘personal trainer’ theme by Steve Deane and I can't get my header image to center
    http://marcelschade.com/

    The image resolution is 1800x236. Of course I will scale it but first I need to know how to center it.

    So far I used the plugin 'Dynamic Headers by Nicasio Design' and the following code in header.php:

    <?php if(function_exists('show_media_header')){ show_media_header(); } ?>

    Can anyone help me with this? Thank you very much!

  2. LapanWebsite
    Member
    Posted 1 year ago #

    Add class="logo" to <img

    And this inside css

    .logo {
    margin: 0 auto;
    display: block;
    }
  3. CaptainS82
    Member
    Posted 1 year ago #

    Great, thanks for your quick response.
    Forgive me that I don't know what I don't know...

    Do I have to paste 'class="logo" to <img' in header.php

    and

    .logo {
    margin: 0 auto;
    display: block;
    }

    in style.css ??

    Tried that but didn't work...

  4. LapanWebsite
    Member
    Posted 1 year ago #

    Where you call your header logo.
    <img src="my-header-logo-url.png" class="logo">

    In style.css

    .logo {
    margin: 0 auto;
    display: block;
    }

    I hope you are working with child theme.
    Don't make changes to parent.
    It's my duty to warn you.

  5. CaptainS82
    Member
    Posted 1 year ago #

    Thanks again! Good to hear that you take your duty seriously :)

    Well it worked with the original header of the theme but not with the custom header which is above the original.

    Do I have to modify this:

    <?php if(function_exists('show_media_header')){ show_media_header(); } ?>

    ?

  6. LapanWebsite
    Member
    Posted 1 year ago #

    I'm not familiar with your code.
    Is that from Dynamic Headers plugin?

    You can ask plugins developer on how to add class or id to headers.

  7. CaptainS82
    Member
    Posted 1 year ago #

    Yes its the option 1 Dynamic Headers code.
    The alternative option 2 would be:

    <?php if(function_exists('dh_get_page_image_url')){ $dynamic_header_url = dh_get_page_image_url(); } ?>

    There is also a plugin option to set New Alt Tag for a specific image but I dont know how. You got an idea? I contacted the author already.

    Thank you!

Topic Closed

This topic has been closed to new replies.

About this Topic