On a blog created by the blog module the page title for the blog reads like "example's blog" where the name (example in this case) is the blog authors username. On these pages you may wish to wish to remove the page title and use the Blog Information block instead.

To do this, in phptemplate, you need to modify your page.tpl.php file. Change:

print $title;

To:

if (arg(0) != 'blog' && $node->type != 'blog') { print $title; }

Note: if you do not have a simple print $title; in your theme, but something a little more complex, you simply need to nest the if statement. For example:

<?php 
if ($title) {
   if (arg(0) != 'blog' && $node->type != 'blog') { ?>
      <h1 class="pageTitle"><?php print $title ?></h1>
<?php 
   }
}?>

This will not display the $title tag on pages that are /blog or have a node type of 'blog'. On all other pages it will be displayed.

Comments

charly71’s picture

What about if I need to show "author's blog" like default title? I mean if the bloginfo title is empty...

Thanks

tsi’s picture

What I did is to replace <?php print $title; ?>
with this on page-blog.tpl.php :

<?php
                    $block = module_invoke('bloginfo', 'block', 'view', 0);
                      if ($block['subject']) {
                        $output = "<div class=\"bloginfo-block\">\n";
                        $output .= "<div id=\"bloginfo-block-title\">".$block['subject']."</div>\n";
                        $output .= "<div class=\"content\">".$block['content']."</div>\n";
                        $output .= "</div>\n";
                        print $output;}
					else print $title;
                    ?>

On the user's blog page - this will give you the blog-info instead of the the normal title and the normal title if blog-info is empty.

and with this on page.tpl.php :

<?php if ($node->type == 'blog'): ?>
               <div id="blog-title">
				   <?php
                    $block = module_invoke('bloginfo', 'block', 'view', 0);
                      if ($block['subject']) {
                        $output = "<div class=\"bloginfo-block\">\n";
                        $output .= "<div id=\"bloginfo-block-title\">".$block['subject']."</div>\n";
                        $output .= "<div class=\"content\">".$block['content']."</div>\n";
                        $output .= "</div>\n";
                        print $output;}
					else print t("@username's blog", array('@username' => $node->name))
                    ?>
                </div>
			<?php endif; ?>

Here you replace the title with the blog-info only if the node type is blog, you might want to give it an alternative (else) for nodes that are not blogs.

Tsachi Shlidor (@shlidor)