I'm trying to wrap a div around two other div's. Inside those divs are wordpress functions.
For example:
I already have the functions working correctly, but I'm trying to use the following code in my page template:
echo '<div class="home-display">';
function home_display_left() {
echo '<div class="wrap">';
genesis_widget_area( 'home-display-left', array(
'before' => '<div class="home-display-left">',
'after' => '</div></div>',
) );
}
function home_display_right() {
echo '<div class="wrap">';
genesis_widget_area( 'home-display-right', array(
'before' => '<div class="home-display-right">',
'after' => '</div></div>',
) );
echo '</div></div>';
}
echo '</div> ';
What's the correct code that I should be putting in my page template?
What you've got there is the home-display div class wrapped around two function definitions. That is, the functions are not run iteratively between the two echo statements - they are simply defined there. You would have to wrap your div tags around where the functions are called, or create a new function to include them:
function home_display_left_right() {
echo '<div class="home-display">';
home_display_left();
home_display_right();
echo '</div> ';
}
Alternatively, include the open and close div tags as needed in the existing definitions:
function home_display_left() {
echo '<div class="home-display">'; // open .home-display
echo '<div class="wrap">';
genesis_widget_area( 'home-display-left', array(
'before' => '<div class="home-display-left">',
'after' => '</div></div>',
) );
}
function home_display_right() {
echo '<div class="wrap">';
genesis_widget_area( 'home-display-right', array(
'before' => '<div class="home-display-right">',
'after' => '</div></div>',
) );
echo '</div></div>';
echo '</div> '; // close .home-display
}