WP theme gurus inside please

Discussion Of All Legal Topics Is Fine Anything Goes. Be Respectful of Others. No Personal Information or Attacks.
All Traffic, Link, Banner, Push Notification and Advertising, Offers & Requests Here,.
Domains & Websites For Sale and Requests Here.
Keep One thread per person & No More Than 1 Weekly Bump.
Post Reply
User avatar
donnie
Verified Member
Verified Member
Posts: 415
Joined: July 12th, 2018, 3:19 am

WP theme gurus inside please

#1

Post by donnie » March 10th, 2021, 10:01 am

If a theme has a left and right sidebar can you change it to show the widgets in the header, there is no header side bar available.

Thanks




Slim
Verified Member
Verified Member
Posts: 435
Joined: September 26th, 2018, 3:02 am

#2

Post by Slim » March 10th, 2021, 12:32 pm

It's code so it can be done I just have no code skills to do it though,good luck.
Some people can be Dumb and Dumber

Colmike7
Banned
Banned
Posts: 1670
Joined: May 23rd, 2018, 12:21 pm
Title: (>^-^)b

#3

Post by Colmike7 » March 10th, 2021, 2:18 pm





User avatar
donnie
Verified Member
Verified Member
Posts: 415
Joined: July 12th, 2018, 3:19 am

#4

Post by donnie » March 10th, 2021, 2:44 pm

thanks will get on it tonight after I finish my postings




User avatar
donnie
Verified Member
Verified Member
Posts: 415
Joined: July 12th, 2018, 3:19 am

#5

Post by donnie » March 10th, 2021, 6:53 pm

Colmike7 I looked and looked and looked at that link, I can not figure out how to take the widgets I have on my site and instead of displaying them on the left or right have them show up on top, any help is real appreciated.I have the widgets all there just want them showing up in the header are.
Thanks for reading and the help.




Colmike7
Banned
Banned
Posts: 1670
Joined: May 23rd, 2018, 12:21 pm
Title: (>^-^)b

#6

Post by Colmike7 » March 10th, 2021, 8:45 pm

It depends on what up top means. But this should help:

To start, in functions.php you will put this code:

Code: Select all

function top_widgets_init() {
 
    register_sidebar( array(
        'name'          => 'Header Widget Area',
        'id'            => 'top-header-widget',
        'before_widget' => '<div class="whateveryouwant">',
        'after_widget'  => '</div>',
        'before_title'  => '<h2 class="whateveryouwantagain">',
        'after_title'   => '</h2>',
    ) );
 
}
add_action( 'widgets_init', 'top_widgets_init' );
Then, at this point you'll see a "Header Widget Area" in the widgets section. Add something there if you want.

Then paste this code in either header.php or wherever the header area that you want the widgets to go is:

Code: Select all

<?php
 
if ( is_active_sidebar( 'top-header-widget' ) ) : ?>
    <div id="header-widget-area" class="top-widget-area widget-area" role="complementary">
    <?php dynamic_sidebar( 'top-header-widget' ); ?>
    </div>
     
<?php endif; ?>
At this point, widgets should show up top where you pasted the code, but they won't look good yet. So, add in this CSS to start:

Code: Select all

div#header-widget-area {
    width: 100%;
    background-color: #f7f7f7;
    border-bottom:1px solid #eeeeee;
    text-align: center;
}   
h2.whateveryouwantagain {
    margin-top: 0px;
    text-align: left;
    text-transform: uppercase;
    font-size: small;
    background-color: #feffce;
    width: 130px;
    padding: 5px;
    }

(Example for a full width widget area up top.)




User avatar
BrasSmonkey
Verified Member
Verified Member
Posts: 7893
Joined: February 28th, 2018, 6:31 pm
Title: Smell My Sack
Referrals: 1
Contact:

#7

Post by BrasSmonkey » March 11th, 2021, 12:46 am

yeah you can google all that to add widgets
THE LAKEN RILEY ACT IS NOW LAW!!! TRUMP 2025!!!
DACA HAS ENDED!!! email: brassballz-@-techie.com

urbanlegend
Verified Member
Verified Member
Posts: 1471
Joined: March 23rd, 2018, 10:13 am

#8

Post by urbanlegend » March 13th, 2021, 6:53 am

Good to know you can do this, it makes using themes much more effective when you like the theme but the side bars are not where you want them.




blingman
Verified Member
Verified Member
Posts: 1134
Joined: May 13th, 2018, 11:19 am

#9

Post by blingman » March 15th, 2021, 9:23 am

why themes do not have a left, right header and footer widget area by default is my question.




User avatar
TheButcher
Administrator
Administrator
Posts: 17530
Joined: February 2nd, 2018, 11:48 am
Title: I like weekends
Referrals: 1
Contact:

#10

Post by TheButcher » March 17th, 2021, 9:38 am

blingman wrote: ↑
March 15th, 2021, 9:23 am
why themes do not have a left, right header and footer widget area by default is my question.
How I see it the guy or gal who designs the theme has their own idea how it would look like so they make it functional for that look.

greatpornlinks
Verified Member
Verified Member
Posts: 1715
Joined: June 14th, 2018, 6:51 pm

#11

Post by greatpornlinks » March 18th, 2021, 8:22 am

Colmike7 wrote: ↑
March 10th, 2021, 8:45 pm
It depends on what up top means. But this should help:

To start, in functions.php you will put this code:

Code: Select all

function top_widgets_init() {
 
    register_sidebar( array(
        'name'          => 'Header Widget Area',
        'id'            => 'top-header-widget',
        'before_widget' => '<div class="whateveryouwant">',
        'after_widget'  => '</div>',
        'before_title'  => '<h2 class="whateveryouwantagain">',
        'after_title'   => '</h2>',
    ) );
 
}
add_action( 'widgets_init', 'top_widgets_init' );
Then, at this point you'll see a "Header Widget Area" in the widgets section. Add something there if you want.

Then paste this code in either header.php or wherever the header area that you want the widgets to go is:

Code: Select all

<?php
 
if ( is_active_sidebar( 'top-header-widget' ) ) : ?>
    <div id="header-widget-area" class="top-widget-area widget-area" role="complementary">
    <?php dynamic_sidebar( 'top-header-widget' ); ?>
    </div>
     
<?php endif; ?>
At this point, widgets should show up top where you pasted the code, but they won't look good yet. So, add in this CSS to start:

Code: Select all

div#header-widget-area {
    width: 100%;
    background-color: #f7f7f7;
    border-bottom:1px solid #eeeeee;
    text-align: center;
}   
h2.whateveryouwantagain {
    margin-top: 0px;
    text-align: left;
    text-transform: uppercase;
    font-size: small;
    background-color: #feffce;
    width: 130px;
    padding: 5px;
    }

(Example for a full width widget area up top.)


Nice piece of tutorial
Never have your honey where you make your money.
~ HeidiHoe 2023

User avatar
HeidiHoe
Verified Member
Verified Member
Posts: 1653
Joined: February 3rd, 2018, 12:20 pm
Title: Resident Genius

#12

Post by HeidiHoe » March 19th, 2021, 4:06 pm

It's not a good idea to modify the code in your themes. When the theme gets updated your modifications get wiped out.

It's better to create a child theme and do your modifications there instead. Child themes are called before parent themes. Any code and/or files placed in the child will be added to or override the parent. This way when the theme gets updated your modifications won't be wiped out.

It's also a good practice to check the child when the parent updates to ensure none of the changes made in the parent conflict with your mods made via child.

It takes a minute to create a child theme. All it is is a folder containing a style and a functions file each with a couple lines of code. It's stupid simple and will save you headaches down the road.

Wordpress.org has easy to follow instructions on child themes. There's also plugins which I think is kind of idiotic.
The Fourth Turning Is Here

Colmike7
Banned
Banned
Posts: 1670
Joined: May 23rd, 2018, 12:21 pm
Title: (>^-^)b

#13

Post by Colmike7 » March 19th, 2021, 4:17 pm

HeidiHoe wrote: ↑
March 19th, 2021, 4:06 pm
It's not a good idea to modify the code in your themes. When the theme gets updated your modifications get wiped out.

It's better to create a child theme and do your modifications there instead. Child themes are called before parent themes. Any code and/or files placed in the child will be added to or override the parent. This way when the theme gets updated your modifications won't be wiped out.

It's also a good practice to check the child when the parent updates to ensure none of the changes made in the parent conflict with your mods made via child.

It takes a minute to create a child theme. All it is is a folder containing a style and a functions file each with a couple lines of code. It's stupid simple and will save you headaches down the road.

Wordpress.org has easy to follow instructions on child themes. There's also plugins which I think is kind of idiotic.
True. I've made a few themes from scratch lately and I wasn't thinking about it being a theme with updates. :p
The first time you make changes to a theme and an update wipes it out, that's usually when most people learn about child themes lol.




minkal
Verified Member
Verified Member
Posts: 139
Joined: October 2nd, 2018, 6:57 pm

#14

Post by minkal » March 23rd, 2021, 9:37 am

Nice link appreciate you sharing it it came in handy




WP theme gurus inside please

Post Reply