How can I modify the $submitted variable for a custom node template? I have a content type called "Blog post" (machine name = blog_post).

I've set up a custom node template that works properly called "node--blog_post.tpl.php"

I'd like my $submitted output to be "by User Name | Month, Day of Month, Year" (example - "by John Smith | November 2, 2016"

I've been working on this for 2-3 hours without being able to have any effect on the output, and have gotten to the point in my searching where the only links I'm finding that seem relevant are things I've already clicked on. I'm stuck.

I know there are multiple ways to do this, but I'm looking for how to make this happen using a theme_preprocess_node function in the template.php file. Not only because I've seen multiple posts saying this is the "best practice", but also to gain more familiarity with the template.php file itself &amp; how it is used.

Any thoughts?
You can do this.In your theme_preprocess_node function create a new variable which is used in your node--blog_post.tpl.php .

 function yourtheme_preprocess_node(&amp;$variables) {
 $node = $variables['node'];
  if ($node-&gt;type == 'blog_post') {
    $created = $node-&gt;created;
    $date = date('F j,Y', $created);
    $name = $node-&gt;name;
    $variables['new_variable'] = "By ".$name." | ".$date;
  }
}


then print this new_variable in your tpl like this.

  &lt;div class="content clearfix"&lt;?php print $content_attributes; ?&gt;&gt;
&lt;?php
  // We hide the comments and links now so that we can render them later.
  hide($content['comments']);
  hide($content['links']);
  print render($content);
  print $new_variable;
?&gt;




Output show like this