Answered: how to add image banner at the top of the main page only and not over the side bar?

Post date: 2024-03-21 20:34:29
Views: 7

Widget Anywhere might be the plugin you're looking for.
Otherwise If you're looking to display a welcome banner, check out the Welcome Widget.


Edit: DIY manually

If you want the banner to fill both the width of the main content and sidebar, go to:
SnowFlat theme > open file qa-theme.php after line 263 paste the following code:

$this->output('<img style="display:block;margin:0 auto;" src="https://i.ibb.co/dLq5QyJ/z897231.png">');

Should look something like this (screenshot):

public function body_content()
{
    ...

    $this->output('<div class="qa-main-wrapper">', '');
   
$this->output('<img style="display:block;margin:0 auto;" src="i.ibb.co/dLq5QyJ/z897231.png">');
    $this->main();
    ...

}

If you want the banner to fill the width of the main content only, and not the sidebar, you'll need to add this function to your qa-theme.php instead. Paste it on line 275 for example (screenshot):

public function main()
{
$content = $this->content;
$hidden = !empty($content'hidden']) ? ' qa-main-hidden' : '';
$this->output('<div class="qa-main' . $hidden . '">');
    
$this->output('<img style="display:block;margin:0 auto;" src="i.ibb.co/dLq5QyJ/z897231.png">');   
    $this->widgets('main', 'top');
    $this->page_title_error();
    $this->widgets('main', 'high');
    $this->main_parts($content);
    $this->widgets('main', 'low');
    $this->page_links();
    $this->suggest_next();
    $this->widgets('main', 'bottom');
    $this->output('</div> <!-- END qa-main -->', '');
}


This rewrites the  main()  function of your theme to add the new banner (See highlighted code). 
Although I believe Widget Anywhere should be able to add content there, as I see there's a widgets main top there, on the  main()  function..

Please click Here to read the full story.
 
Other Top and Latest Questions:
Here are Wednesday's biggest analyst calls: Tesla, Amazon, Airbnb, Domino's, Walmart, Disney & more
Paramount and Skydance inch closer to a merger as key hurdle looms, sources say
All Elite Wrestling: Dynamite: April 24, 2024
Microsoft says cloud AI demand is exceeding supply even after 79% surge in capital spending
Toymaker Hasbro's turnaround efforts help first-quarter profit beat, ease sales decline
U.S. crude oil pulls back below $83 a barrel as brief rally stalls out
Mortgage demand drops as interest rates soar over 7%
Android messages website keeps insta-crashing Chrome
X-Men '97: Bright Eyes
The Apothecary Diaries: The Unsettling Matter Of The Spirit