$option ) { if ( $name == 'tag' ) continue; if ( $name == 'content' ) continue; if ( $name == 'return' ) continue; if ( $name == 'tag_type' ) continue; $tag_attributes .= sprintf( ' %s="%s"', $name, $option ); } switch ( $tag_options['tag_type'] ) { case 'single': $format = '%3$s <%1$s%2$s />' ; break; case 'single-after': $format = '<%1$s%2$s /> %3$s' ; break; case 'open': $format = '<%1$s%2$s>%3$s'; break; case 'close': $format = '%3$s'; break; default: $format = '<%1$s%2$s>%3$s'; break; } $composite = sprintf( $format, $tag_options['tag'], $tag_attributes, $tag_options['content'] ); if ( $tag_options['return'] == true ) return $composite ; echo $composite; } /** * Boring Header and paragraph either echoed or returned... */ function boring_html( $header, $content, $return = false ) { $the_h2 = array( 'tag' => 'h2', 'content' => $header ); $the_content = array( 'tag' => 'p', 'id' => 'boring_content_id', 'style' => 'border: 1px solid red', 'class' => 'boring_content_class', 'content' => $content ); if ( $return ) { $the_h2[ 'return' ] = true; $the_content[ 'return' ] = true; return $this->the_tag( $the_h2 ) . $this->the_tag( $the_content ); } else { $this->the_tag( $the_h2 ); $this->the_tag( $the_content ); } } } $boring = new boring_tag_creator; $boring->boring_html( 'The Title', 'Some words about this for the content.' ); $boring_html_variable = $boring->boring_html( 'Another Title', 'More words about this other thing for the content.', true ); echo $boring_html_variable; ?>