• Resolved ashtonpc

    (@ashtonpc)


    I would like to display the site title either above or below the header image but at the moment they are superimposed on top of each other.

    Can you help? I cannot find an option to do this.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Theme Author Tajam

    (@tajam)

    The header image feature in this theme is used as a background for the header area, so the site title will always be on top of the image. If you want to insert an image above the header, you can use miniva_header_before hook. This is the code example:

    add_action(
    	'miniva_header_before',
    	function() {
    		echo '<img src="https://example.com/image.jpg">';
    	}
    );

    You can insert this code in functions.php file in your child theme or in your custom plugin.

    Thread Starter ashtonpc

    (@ashtonpc)

    Hi Tajam,

    brilliant, thank you. I have done that and it works.

    However, the image is now left aligned and I would like it horizontally centred. How do I do that? Apologies if these questions seem trivial but I’m new to Themes in WordPress!

    Thanks
    Paul

    Thread Starter ashtonpc

    (@ashtonpc)

    I also forgot to ask. I am using a staging site to edit the website before pushing it live. I have added the staging URL path tot he image in the function above. Will that be automatically edited to the live URL when I publish or will I need to edit it or change it to a relative path?

    The image will be in the wp-content/uploads folder.

    Thanks again
    Paul

    Theme Author Tajam

    (@tajam)

    To make the image centered, you can use a div container and set it to align center:

    add_action(
    	'miniva_header_before',
    	function() {
    		echo '<div style="text-align:center"><img src="https://example.com/image.jpg"></div>';
    	}
    );

    If your site is not in a subdirectory, you can use image url without the domain name, for example: /wp-content/uploads/image.jpg

    Thread Starter ashtonpc

    (@ashtonpc)

    Thank you. I had tried the div tag method myself but it did not work! When I tried it again by copying your code it worked so I am guessing I must have mistyped something when I did it.

    It all looks fine now.

    Thank you so much for your help.

    One final question if I may. In your solution above you refer to the ‘miniva_header_before’, hook. I have been through the theme documentation but I cannot find a list of all the different/possible hooks that exist. Where are they listed? I’d like to investigate further.

    Thanks again
    Paul

    Theme Author Tajam

    (@tajam)

    Sorry, hooks are not listed in the documentation. You need to search for do_action in the theme files to see all available hooks.

    Thread Starter ashtonpc

    (@ashtonpc)

    OK, thanks. I’ll do that ??

    Best wishes
    Paul

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Display Site Title below or above header image’ is closed to new replies.