Archived topic
Center a shortcode in a GeneratePress Element
3 replies · Started by Henry on May 17, 2019
Here's my shortcode (which I have placed in the functions.php and works great).
This function simply shows the generic WordPress Search Form:
function shapeSpace_display_search_form() {
return get_search_form(false);
}
add_shortcode('display_search_form', 'shapeSpace_display_search_form');
In a Hook Element, I'd like to center the search form - that's it.
I thought something simple like this would work:
<div class="center">
[display_search_form]
</div>
However, it just aligns to the left.
Any ideas?
Thanks
Hi there,
A class doesn't actually mean anything without CSS targetting it.
You can either use HTML inline style:
https://www.w3schools.com/html/html_styles.asp
https://www.w3schools.com/cssref/pr_text_text-align.asp
Or target the class with CSS:
.center {
text-align: center;
}
This site is excellent for learning basic HTML and CSS if you are interested:
https://www.codecademy.com/
Thansk Leo -yes, I knew that - I just thought that GP has that .center class baked in.
Thanks again!!
No problem :)