Community Forums › Forums › Archived Forums › Design Tips and Tricks › content in new widget areas no displaying
Tagged: sidebars, Simple Hooks, widget areas
- This topic has 14 replies, 3 voices, and was last updated 11 years, 8 months ago by
Brad Dalton.
-
AuthorPosts
-
July 15, 2013 at 6:30 am #50761
Elaine Griffin
MemberHi,
http://www.aimeebroussard.com
I cannot for the life of me get my content to display in new widget areas. I want them only to show on the homepage, so I'm using widget logic and using this conditional:
is_front_page()
I have also tried using is_page( 'home' )
I have this added to genesis_post_content in simple hooks:
<div class="slider-sidebar">
<?php dynamic_sidebar( 'slider-sidebar' ); ?>
</div>
<div class="kitchen-widget">
<?php dynamic_sidebar( 'kitchen-widget' ); ?>
</div>
<div class="craft-widget">
<?php dynamic_sidebar( 'craft-widget' ); ?>
</div>
<div class="shop-widget">
<?php dynamic_sidebar( 'shop-widget' ); ?>
</div>
<div class="latest-post-widget">
<?php dynamic_sidebar( 'latest-post-widget' ); ?>
</div>
<div class="about-widget">
<?php dynamic_sidebar( 'about-widget' ); ?>
</div>
I'm so frustrated by this, and I would appreciate any help.
FYI, the information that is displaying was code added to the actual home page by the previous designer.
Thanks!July 15, 2013 at 6:49 am #50767AnitaC
KeymasterTry changing this from is_front_page to is_home.
Need help with customization or troubleshooting? Reach out to me.
July 15, 2013 at 6:58 am #50768Brad Dalton
ParticipantIn my opinion, an easier and better way to do this to to add custom functions which both register the new widgets and hook them into position using your child themes functions.php file:
Here's an example:
Rinse and repeat as they say.
is_front_page should be used when not using the default settings for front page meaning you have selected a static page as your home page.
is_home should be used when using the default home page when Display latest posts is selected in your reading settings.
Another option is to use a home.php file from another theme and modify it.
July 15, 2013 at 7:55 am #50777Elaine Griffin
MemberThanks anitac. I did try that, and it didn't work. Plus, it is a static landing page.
Brad, thanks so much. I just ran across similar code this morning and thought I would like to try this out. I'm going to give it a try.
Can I ask, though, what is the "5" for on line 10?
Thanks!July 15, 2013 at 8:53 am #50786Brad Dalton
Participant5 is the 3rd parameter for positioning priority.
You could use the same hook and use different priority numbers to determine which widget outputs first and in which order.
So you could use 15 for the second widget which is kitchen:
$priority
(integer) (optional) Used to specify the order in which the functions associated with a particular action are executed. Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action.Default: 10
Source: WordPress Codex
July 15, 2013 at 11:13 am #50804Elaine Griffin
MemberAwesome, thank you so much!
July 16, 2013 at 2:46 am #50927Elaine Griffin
MemberOkay, I used the code on another site I'm working on, and it displayed just fine. I am using it on the original site I asked about, and none of the content is displaying.
I have tried adding the code to both functions.php, and home.php, and I have the same outcome.
Thanks!July 16, 2013 at 3:53 am #50929Brad Dalton
ParticipantThe code will only work in functions, not in your home.php file. If you copy it from the view raw link and paste it using a code editor at the end of your child themes functions.php file, it works.
July 16, 2013 at 3:55 am #50930Elaine Griffin
MemberThe funny thing is the widgets are there in the dashboard, and I have added the text content/plugins, but it's not showing on the actual page.
July 16, 2013 at 4:00 am #50931Brad Dalton
ParticipantWhat page?
is_front_page should be used when not using the default settings for front page meaning you have selected a static page as your home page.
is_home should be used when using the default home page when Display latest posts is selected in your reading settings.
July 16, 2013 at 4:04 am #50932Elaine Griffin
MemberYep, it's set up as a landing page with the page called "home" as the front static page.
The information that is in there now is some HTML inserted by the former designer, and it's inserted directly into the page.July 16, 2013 at 4:10 am #50933Brad Dalton
ParticipantShould work, Try changing the conditional tag to page-id-1837
if ( is_page(1837) && is_active_sidebar( 'kitchen-widget' ) ) {
July 16, 2013 at 4:30 am #50934Elaine Griffin
MemberNo, still nothing. This is crazy!
July 16, 2013 at 7:59 am #50939Elaine Griffin
MemberI am trying this on another site, and it's not working there, either. So, out of three, one works, and one doesn't. I can't figure out what I've done. 🙁
July 16, 2013 at 9:57 am #50949Brad Dalton
ParticipantSend me the child themes functions.php files for the sites it isn't working on please: [email protected]
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.