Archived topic
Question - is it possible? Elements & widgets - background banner and text
3 replies · Started by Sarah on April 23, 2021
So my question is really a is it possible - I know that I can do this with advanced custom fields - but I try to use fewer plugins if I can..
In functions file I call a widget
register_sidebar( array(
'name' => 'Home Page Banner',
'id' => 'widget_banner',
'before_widget' => '<div class="w_banner">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
) );
So use Elements as a Hook to call this widget
<?php if ( is_active_sidebar( 'widget_banner' )) { ?>
<div id="widget_banner">
<div class="widget_banner">
<?php dynamic_sidebar( 'widget_banner' ); ?>
</div>
<div class="clear"></div>
</div>
<?php } ?>
Then in the widget itself I can pull in whatever is needed - however if this instant I want a banner full width image PLUS text over laying that banner - my question is - is it possible to have 2 areas in that widget - 1. an image and 2. a HTML text box - the image is used as a background image within the elements hook code and then text then overlaid
I know I can create the banner image with in CSS or in the widget itself or even into the element hook itself - but thinking of a client updating in future it would be simpler for them if they only needed to edit a widget and replace with a new image?
Is this possible with GPP? Its so versatile I was not sure! I did search but couldn't see anything - so this might be outside the support remit - which is 100% fine - just thought that I would ask
Thank you
Sarah
Hi there,
it sounds like you need to create a Custom Widget to be added to your Custom Widget Area. As i assume the user would be editing the Widget itself ?
There are some topics on the web that provide some code for creating your own widget.
understand I can certainly look into that then - thanks
You're welcome