Results 1 to 7 of 7

Thread: How to add a H3 tag

  1. #1

    Thread Starter
    Hyperactive Member Olly79's Avatar
    Join Date
    May 2005
    Posts
    264

    How to add a H3 tag

    Hi all,

    Below is my code:
    HTML Code:
    <?php
    
    }
    
    
    function contact_widget($args) {
    		$options = get_option('contact_widget');
    		$title = $options['title'];
    	echo $args['before_widget'];
    	echo $args['before_title'] ;
    	echo $title;
    	echo  $args['after_title'];
    	?>
    And I basically want the 'title' to have a H3 tag to size the font it output in the header section of the contact form.

    Can anyone tell me how to do this please?

    Thanks

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: How to add a H3 tag

    there are usually better ways to do this (as I don't support echoing HTML so much), but this would probably work best for this situation in particular.
    PHP Code:
    <?php
    function contact_widget($args) {
        
    $options get_option('contact_widget');
        
    $title $options['title'];
        echo 
    '<h3>';
        echo 
    $args['before_widget'];
        echo 
    $args['before_title'] ;
        echo 
    $title;
        echo  
    $args['after_title'];
        echo 
    '</h3>';
    }
    ?>
    the alternative might look like:
    PHP Code:
    <?php
        
    function contact_widget($args) {
            
    $options get_option('contact_widget');
            
    $title $options['title'];
    ?>
    <h3><?php echo $args['before_widget'] . $args['before_title'] . $title $args['after_title']; ?></h3>
    <?php
        
    }
    ?>
    Last edited by kows; Jun 28th, 2010 at 10:07 AM.

  3. #3
    Frenzied Member TheBigB's Avatar
    Join Date
    Mar 2006
    Location
    *Stack Trace*
    Posts
    1,511

    Re: How to add a H3 tag

    Minor correction
    PHP Code:
    <?php
    function contact_widget($args) {
        
    $options get_option('contact_widget');
        
    $title $options['title'];
        echo 
    $args['before_widget'];
        echo 
    $args['before_title'] ;
        echo 
    '<h3>';
        echo 
    $title;
        echo 
    '</h3>';
        echo  
    $args['after_title'];
    }
    ?>
    I think the OP meant this.
    Delete it. They just clutter threads anyway.

  4. #4
    Member
    Join Date
    Jun 2010
    Posts
    55

    Re: How to add a H3 tag

    Could of also been written.

    PHP Code:
    1. echo '<h3>$title</h3>';

  5. #5
    Frenzied Member TheBigB's Avatar
    Join Date
    Mar 2006
    Location
    *Stack Trace*
    Posts
    1,511

    Re: How to add a H3 tag

    Quote Originally Posted by Ash.Burlaczenko View Post
    Could of also been written.

    PHP Code:
    1. echo '<h3>$title</h3>';
    2. //this will echo literally <h3>$title</h3>
    A couple of working methods of concatenation
    Code:
    echo "<h3>$title</h3>";
    Code:
    echo '<h3>' . $title . '</h3>'
    Code:
    echo '<h3>', $title, '</h3>'
    Doesn't really matter which one you use; none of them differ significantly in benchmarks.
    You should however try to stick to one style for coding aesthetics.
    Last edited by TheBigB; Jun 29th, 2010 at 04:03 PM.
    Delete it. They just clutter threads anyway.

  6. #6
    Frenzied Member TheBigB's Avatar
    Join Date
    Mar 2006
    Location
    *Stack Trace*
    Posts
    1,511

    Re: How to add a H3 tag

    I stand to correct myself.
    Concatenation with comma seems to be faster.
    Unless your building a multi-million viewer website you shouldn't notice the difference.
    Delete it. They just clutter threads anyway.

  7. #7
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: How to add a H3 tag

    Quote Originally Posted by Ash.Burlaczenko View Post
    Could of
    Could have.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width