ThemeShaper Forums » Thematic

[closed]

How to add a DIV tag inside a function

(5 posts)
  • Started 8 years ago by mogito2000
  • Latest reply from helgatheviking
  • This topic is resolved
  1. mogito2000
    Member

    Hello,

    Im having trouble adding a div tag with a funtion.

    This is the code im trying to use:

    function child_primary_aside() {
    	if (is_single()) {
    
            <DIV TAG TO GO HERE?? >
    
    	$posttitle = '<h2>Project Information';
    	$posttitle .= "</h2>";
    	echo $posttitle;
    
    	the_excerpt();
    
            <DIV TAG TO END HERE?? />
    
    	}
    	elseif (is_active_sidebar('primary-aside')) {
    		echo thematic_before_widget_area('primary-aside');
    		dynamic_sidebar('primary-aside');
    		echo thematic_after_widget_area('primary-aside');
    	}
    }

    All i get when using this is a white screen. Is it possible to add DIV tags inside funtions?? If not, how would one go about doing this??

    Thanks for any advice given.

    Mogito

    Posted 8 years ago #
  2. where are you trying to put the div?

    Posted 8 years ago #
  3. mogito2000
    Member

    Hi Helgatheviking,

    Thanks for your quick response!

    Im trying to wrap the output of the function with a DIV tag - i have added where i thought it "should" have gone.....?

    Posted 8 years ago #
  4. mogito2000
    Member

    After a fair bit of trial and error i got it working by echoing variable values. Im not sure if this is the best way to go about doing it but it seems to work.

    Thanks

    Mogito

    Posted 8 years ago #
  5. you can either echo the div or close the php brackets ?> and type straight html, then <?php to open the php. using the first method, i think this ought to work.

    function child_primary_aside() {
    	if (is_single()) {
    
            echo "<div>";
    
    	$posttitle = '<h2>Project Information';
    	$posttitle .= "</h2>";
    	echo $posttitle;
    
    	the_excerpt();
    
            echo "</div>";
    
    	}
    	elseif (is_active_sidebar('primary-aside')) {
    		echo thematic_before_widget_area('primary-aside');
    		dynamic_sidebar('primary-aside');
    		echo thematic_after_widget_area('primary-aside');
    	}
    }
    Posted 8 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.