Homepage › Community Forums › Epik Theme Support › Welcome Feature 4-6
Tagged: function, home.php, PHP, welcome feature, widgets
Hello Wes,
I’m adding a second Welcome feature secture 4-6
I copied the css from 7a and duplicated it,
I copied the home.php and the functions php.
I’d like the second, or Welcome feature 4-5 to appear just under the home-feature-1&2 section but I can’t get the code right to make them appear.
The 4-6 widgets are also stacking instead of displaying side by side (when I briefly get them to appear).
Here’s where I am so far…
<code>/**
* Display widget content for the “Home Feature 2″ section.
*
*/
function epik_home_loop_helper_welcome() {
if ( is_active_sidebar( ‘welcome-feature-4’ ) || is_active_sidebar( ‘welcome-feature-2’ ) || is_active_sidebar( ‘welcome-feature-3’ ) ) {
echo ‘<div id=”welcome-features”>’;
if ( is_active_sidebar( ‘welcome-feature-4’ ) ) {
echo ‘<div class=”welcome-feature-4″>’;
dynamic_sidebar( ‘welcome-feature-4’ );
echo ‘</div><!– end .welcome-feature-4 –>’;
}
if ( is_active_sidebar( ‘welcome-feature-5’ ) ) {
echo ‘<div class=”welcome-feature-5″>’;
dynamic_sidebar( ‘welcome-feature-5’ );
echo ‘</div><!– end .welcome-feature-5 –>’;
}
if ( is_active_sidebar( ‘welcome-feature-6’ ) ) {
echo ‘<div class=”welcome-feature-6″>’;
dynamic_sidebar( ‘welcome-feature-6’ );
echo ‘</div><!– end .welcome-feature-6 –>’;
}
echo ‘</div><!– end .welcome-features –></div><!– end .wrap –></div><!– end #welcome –>’;
}
}</code>
)
As mentioned before, you just need to copy, paste and make sure you rename the functions inside the home.php file, and place the newly created widgets in the exact order you want them to appear. You’ll also need to register the widgets within the functions.php file, and then add your css. If your widgets are stacking that probably means its not linked to any css….so double check your css styles to makes sure they match up with what you have.
Is the code I’m using above correct? I’m not quite sure where to paste it in the functions.php.
I took out the wide portion because I don’t need a second welcome feature wide, but I’m not sure I recoded it correct.
I get an error when I insert it.
/**
* Display widget content for "Home Feature Middle" section.
*
*/
function epik_home_loop_helper_middle() {
if ( is_active_sidebar( 'home-feature-1' ) || is_active_sidebar( 'home-feature-2' ) ) {
echo '';
if ( is_active_sidebar( 'home-feature-1' ) ) {
echo '';
dynamic_sidebar( 'home-feature-1' );
echo '<!-- end .feature-1 -->';
}
if ( is_active_sidebar( 'home-feature-2' ) ) {
echo '';
dynamic_sidebar( 'home-feature-2' );
echo '<!-- end .feature-2 -->';
}
echo '<!-- end .wrap --><!-- end #home-feature-bg-alt -->';
}
/**
* Display widget content for the "Home Feature 2" section.
*
*/
function epik_home_loop_helper_welcome() {
if ( is_active_sidebar( 'welcome-feature-4' ) || is_active_sidebar( 'welcome-feature-5' ) || is_active_sidebar( 'welcome-feature-6' ) ) {
echo '';
echo '';
if ( is_active_sidebar( 'welcome-feature-4' ) ) {
echo '';
dynamic_sidebar( 'welcome-feature-4' );
echo '<!-- end .welcome-feature-4 -->';
}
if ( is_active_sidebar( 'welcome-feature-5' ) ) {
echo '';
dynamic_sidebar( 'welcome-feature-5' );
echo '<!-- end .welcome-feature-5 -->';
}
if ( is_active_sidebar( 'welcome-feature-6' ) ) {
echo '';
dynamic_sidebar( 'welcome-feature-6' );
echo '<!-- end .welcome-feature-6 -->';
}
echo '<!-- end .welcome-features --><!-- end .wrap --><!-- end #welcome -->';
}
}
if ( is_active_sidebar( 'home-feature-3' ) ) {
echo '';
dynamic_sidebar( 'home-feature-3' );
echo '<!-- end .feature-3 --><!-- end .wrap --><!-- end #home-feature-bg -->';
}
if ( is_active_sidebar( 'home-feature-4' ) ) {
echo '';
dynamic_sidebar( 'home-feature-4' );
echo '<!-- end .feature-4 --><!-- end .feature-4 --><!-- end #home-feature-bg-alt -->';
}
}
With the code from the previous post I keep losing the slider widget….
I added 4,5,6 to the functions meta but it’s still not coming out right.
function epik_home_genesis_meta() {
if ( is_active_sidebar( ‘slider’ ) || is_active_sidebar( ‘welcome-wide’ ) || is_active_sidebar( ‘welcome-feature-1’ ) || is_active_sidebar( ‘welcome-feature-2’ ) || is_active_sidebar( ‘welcome-feature-3’ ) || is_active_sidebar( ‘welcome-feature-4’ ) || is_active_sidebar( ‘welcome-feature-5’ ) || is_active_sidebar( ‘welcome-feature-6’ ) || is_active_sidebar( ‘home-feature-4’ ) || is_active_sidebar( ‘home-feature-5’ ) || is_active_sidebar( ‘home-feature-6’ ) || is_active_sidebar( ‘home-feature-7’ ) || is_active_sidebar( ‘home-feature-8’ ) || is_active_sidebar( ‘home-feature-9’ ) || is_active_sidebar( ‘home-feature-10’ ) || is_active_sidebar( ‘home-feature-11’ ) || is_active_sidebar( ‘home-feature-12’ ) || is_active_sidebar( ‘home-feature-13’ ) || is_active_sidebar( ‘home-feature-14’ ) ) {
You don’t need to add the meta at the top, that is there just in case you’re not using widgets, and if you’re not, then it will show the blog. Since you are using widgets, just leave that section as it was originally to avoid errors.
Just make sure everything matches between function/widget names through home.php, functions.php, and style.css. Make sure that whatever you copied is renamed and it should work fine.
Yes this can all be done by following the above advice. You may need to add your newly created welcome widgets inside their own div if they need to be separate from other widgets.
OK.
It looks like I’m trying to insert my 3 widgets code in between these two…
if ( is_active_sidebar( ‘home-feature-3’ ) ) {
echo ‘<div id=”home-feature-bg”><div class=”wrap”><div class=”home-feature-3″>’;
dynamic_sidebar( ‘home-feature-3’ );
echo ‘</div><!– end .feature-3 –></div><!– end .wrap –></div><!– end #home-feature-bg –>’;
}
if ( is_active_sidebar( ‘home-feature-4’ ) ) {
echo ‘<div id=”home-feature-bg-alt”><div class=”wrap”><div class=”home-feature-4″>’;
dynamic_sidebar( ‘home-feature-4’ );
echo ‘</div><!– end .feature-4 –></div><!– end .feature-4 –></div><!– end #home-feature-bg-alt –>’;
}
Do I create home feature 3 as one separate section, then duplicate it and name section 4 as a separate section, then duplicate welcome feature 1-3 (rename 4-6), then insert welcome feature 4-6 in between them?
Sorry I keep getting errors, I’m trying to figure out how to go about this…
The functions.php and CSS seem to be working fine, I just can’t get the home.php correct…
According to the image above, you should leave home feature 3 and 4 alone since it’s already in the right spot…..I’m guessing you’re referring to home feature 1 and 2 which should both be inside the same div separate from the welcome 1-3 widgets….the same goes for your welcome 4-6 widgets. If you’ve made errors then just start over fresh, since one mistake can break everything.