|
-
Jun 28th, 2010, 07:33 AM
#1
Thread Starter
Hyperactive Member
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
-
Jun 28th, 2010, 10:00 AM
#2
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.
-
Jun 28th, 2010, 12:31 PM
#3
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.
-
Jun 29th, 2010, 03:54 PM
#4
Member
Re: How to add a H3 tag
Could of also been written.
-
Jun 29th, 2010, 03:59 PM
#5
Re: How to add a H3 tag
 Originally Posted by Ash.Burlaczenko
Could of also been written.
PHP Code:
echo '<h3>$title</h3>'; //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.
-
Jun 29th, 2010, 04:07 PM
#6
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.
-
Jun 30th, 2010, 01:24 AM
#7
Re: How to add a H3 tag
 Originally Posted by Ash.Burlaczenko
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|