cswake Posted December 18, 2010 Share Posted December 18, 2010 Hi, I'm modifying the following PHP code from a Wordpress plugin: /* Byline. */ if ( $instance['byline'] ) echo do_shortcode( "<p class='byline'>{$instance['byline']}</p>" ); /* Entry title. */ if ( 'widget' !== $instance['entry_container'] && $instance['entry_title'] && $show_entry_title ) { the_title( "<{$instance['entry_title']} class='entry-title'><a href='" . get_permalink() . "' title='" . the_title_attribute( 'echo=0' ) . "' rel='bookmark'>", "</a></{$instance['entry_title']}>" ); } elseif ( 'widget' !== $instance['entry_container'] && $show_entry_title ) { the_title( "<a href='" . get_permalink() . "' title='" . the_title_attribute( 'echo=0' ) . "' rel='bookmark'>", "</a>" ); } The output currently is: [ December 13, 2010 ] Post Title I'm trying to combine the two so that the output appears on one line. What is the operator to execute multiple command in one statement? Thanks. Quote Link to comment Share on other sites More sharing options...
cswake Posted December 19, 2010 Author Share Posted December 19, 2010 ...bumping this up for the Sunday crowd... Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted December 19, 2010 Share Posted December 19, 2010 What is the operator to execute multiple command in one statement? I don't understand the question. What do you mean 'execute multiple command in one statement'? if you want to put 2 strings together, just concatenate them with . $str = "hello". " ". "world"; echo $str; [code] output: hello world Quote Link to comment Share on other sites More sharing options...
cswake Posted December 19, 2010 Author Share Posted December 19, 2010 Sorry if I wasn't clear, I'm just asking how to combine the Byline section into the Entry title. The end result as I imagine it would look something like (this code doesn't work, of course): if ( $instance['byline']&& 'widget' !== $instance['entry_container'] && $instance['entry_title'] && $show_entry_title ) { echo do_shortcode( "<span class='byline'>{$instance['byline']}</span>" ) && the_title( "<{$instance['entry_title']} class='entry-title'><a href='" . get_permalink() . "' title='" . the_title_attribute( 'echo=0' ) . "' rel='bookmark'>", "</a></{$instance['entry_title']}>" ); } Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted December 19, 2010 Share Posted December 19, 2010 dot (period) is the concatenation operator. so to combine the output of the 2 commands, you'd do something more like echo do_shortcode( "<span class='byline'>{$instance['byline']}</span>" ) . the_title( "<{$instance['entry_title']} class='entry-title'><a href='" . get_permalink() . "' title='" . the_title_attribute( 'echo=0' ) . "' rel='bookmark'>", "</a></{$instance['entry_title']}>" ); } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.