Community Forums › Forums › Archived Forums › Design Tips and Tricks › Agency Welcome Widget – How to Make Another
Tagged: Agency, agency welcome, welcome widget, widgets
- This topic has 6 replies, 2 voices, and was last updated 11 years, 6 months ago by eluviis.
-
AuthorPosts
-
February 28, 2013 at 2:09 pm #23341eluviisMember
I really like the wide Agency welcome widget. It's sad that all remaining 6 widgets on the theme (minus the slider) are all 3 column squares.
How can I add another wide widget similar to the Welcome widget just below the slider?
I'm OK replacing all 3 home widgets for a wide one, or adding an extra one, either way.
February 28, 2013 at 2:34 pm #23344Brad DaltonParticipantUse this tutorial with the is_home() conditional tag and change the hook http://designsbynickthegeek.com/tutorials/add-widgeted-sidebar
February 28, 2013 at 4:31 pm #23379eluviisMemberThanks, I got it to work with that tutorial...
1. I registered the widget - Check!
2. Then I tried using simple hooks to display it, but that didn't work of couse, because I only want it in the middle of the homepage.
3. So... I went to home.php and found the code for the home-welcome widget I'm trying to duplicate.
4. I duplicated this code for function agency_home_welcome_helper () {
if ( is_active_sidebar( 'home-welcome' ) ) {
echo '<div id="home-welcome">';
dynamic_sidebar( 'home-welcome' );
echo '</div><!-- end #home-welcome -->';
}And I changed the home-welcome to "home-wide" the name of my new widget. Like this:
if ( is_active_sidebar( 'home-wide' ) ) {
echo '<div id="home-wide">';
dynamic_sidebar( 'home-wide' );
echo '</div><!-- end #home-wide -->';
}It works!
I do have one doubt. Do I also have to add "home-wide" (my new widget's ID) to this string of PHP code that's in the home.php (there's mention of all the widgets on the homepage, so I would guess I need to add my new "home-wide" as well, right?
--------------------------------------
function agency_home_genesis_meta() {
if ( is_active_sidebar( 'home-welcome' ) || is_active_sidebar( 'home-slider' ) || is_active_sidebar( 'home-left' ) || is_active_sidebar( 'home-middle' ) || is_active_sidebar( 'home-right' ) ) {
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_after_header', 'agency_home_welcome_helper' );
add_action( 'genesis_loop', 'agency_home_loop_helper' );
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
add_filter( 'body_class', 'add_body_class' );function add_body_class( $classes ) {
$classes[] = 'agency';
return $classes;
}}
}--------------------------------------
February 28, 2013 at 4:42 pm #23382Brad DaltonParticipantYou'll also need to duplicate the CSS and change the selectors.
And yes, the new widget needs a unique i.d.
If it works then you won't need to do this:
I would have created a new widget using the code from Nicks site rather than duplicate the widget in the home.php. Why didn't this work for you?
Do you want the new widget sitewide or just home?
I think its better if you use this code from Brian and change the class and hook if needed http://www.briangardner.com/welcome-text-widget/
February 28, 2013 at 5:05 pm #23388eluviisMemberI did create the widget using Nick's tutorial. That makes it work in the WordPress UI as it registers properly. My problem came when displaying the widget as I only want it in the middle of the homepage. I couldn't find anything on Nick's article that could help me for that part.
That's when I had the idea to look in the home.php.
That's when I duplicated the code for the home-welcome and just changed the ID and name to home-wide (so I would have both).
I then copied the CSS from #home-welcome and duplicated it for #home-wide - and changed a couple of parameters.
I'm still unsure about that bit of PHP code at the top of home.php that states all the homepage widgets except my new one. Not sure if I have to add it there for some reason... so if @nickthegeek sees this, maybe he can point me in the right direction
However, the widget displays and works brilliantly.
Look here for the content-wide text with header right under the slider: http://ravx.com/xrd/ (temporary link).
This is the text display you are looking for:
XRD Offers Solutions for Dedicated Cyclists
Long hours in the saddle are challenging. XRD provides solutions that put excitement and pleasure back into competitive cycling. Some cycle to win and some cycle for fun, but we are all serious about our sheer love of riding.
Continue scrolling below to see more of what XRD has to offer...
THANKS!!!!!!!!!!!!!!!!
February 28, 2013 at 5:42 pm #23398Brad DaltonParticipanthahaha.
Site looks good. Be better if you could make the background of the sliders content excerpt transparent with white text.
February 28, 2013 at 6:50 pm #23412eluviisMember^^^ I'll take a look into that tomorrow. I'm not actually seeing exactly that. My slider is all white with black text over the regular white excerpt box. (which only shows when it covers a section of product photo). Maybe making it translucent would be good. But I have to test this in various browsers now.
I have to publish this thing by tomorrow afternoon, so I'm rushing to make changes, but the site is almost complete. Made a tons of progress today.
Thanks for all your help man.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.