Site logo

Archived topic

Banner on [wp_head] hook to be centered

8 replies · Started by Jorge on September 16, 2016

Viewing posts 1–9 of 9

Hi Tom,

I would like the banner I placed on [wp_head] GP-hook to be displayed centered. Now, it's shown aligned-left, no matter what I edit!

Please visit http://www.chorizosibericos.es to check.

Thanks once again,

Jorge

Hi

You can enclose your banner like this

 <div class="div-centered">
YOUR BANNER
</div>

Then the following css

.div-centered {
    text-align: center;
}

I think that should work.

Hi Jamal,

Thanks for your suggestion. I'm afraid I would need somo more advice on what you mean by 'enclosing'. My fault, for I didn't specify which plugin I'm using: Soliloquy Lite

I presume I am to enclose it into CustomPHP, but how do you think I should do it?

Many thanks.

Hi

By enclose i meant put it inside a div. Just replace "YOUR BANNER" with the shortcode you were using and then add the css. That is it, sorry if i confused you by using the wrong terminology.

On a side note, see Tom's advice on using wp_head hook for other things than scripts.

Please don't hesitate to ask if you would like more clarifications.

Thanks again,

Let me tell you what I did:

I added CSS in Simple CSS plugin:

.div-centered {
    text-align: center;
}

I introduced the code you provided in Simple PHP plugin, replacing "YOUR BANNER" with the appropiate plugin shortcode:

<div class="div-centered">
[soliloquy id="322"]
</div>

I first introduced it before the closing PHP tag "?>", but got an error. Then placed it right afterwards, and this is the result: http://www.chorizosibericos.es

I must be doing something wrong. Please, pardon my inability in terms of code, but I'm afraid I have to ask for your advice once more :)

Thanks so much.

You may now see a confusing setup; WordPress seems to be undergoing issues with uploading/retrieving the images from the library. As for now, I'm not able to upload or access to them. Let's wait till WP comes back to normal, I'll keep you posted :)

Not WP issues, seems I'm having trouble with Javascript or something. Let me come back to you as this is solved, whether to go on with the thread or to communicate what the problem was, to whom might be interested.

Please, pardon this inconvenience.

Hi Jamal,

Everything's back to normal, and you were outright spot on:

I added this CSS in Simple-CSS plugin:

.div-centered {
    text-align: center;
}

Introduced this code in [Before Header] hook:

<div class="div-centered">
[soliloquy id="397"]
</div>

And the banner is now displayed perfectly centered, no issues whatsoever: http://www.chorizosibericos.es

All trouble was due to my blunder when placing the code in the wrong place. Talked to Soliloquy Plugin owners, they offered to kindly test any conflict between plugins, and Custom-PHP turned out to generate issues with Soliloquy. But that wasn't actually it, but my confusion with the code I had introduced in it.

My apologies, you were obviously right from the very beginning. Thanks so much, I very much appreciate your so kind attentions :)

Best,

Jorge

This archived topic is closed to new replies.