trying to remove the blog homepage block title link

Events happening in the community are now at Drupal community events on www.drupal.org.
pkcho's picture

The blog homepage block title is actually a link when most other block titles are not (the multimedia block title is also a link). Because it links, when I change the css for the H3, it does not change with the rest of the block titles.

How can I make it so the block titles do not link?

Thank you.

Comments

I'm not exactly sure what

Adam S's picture

I'm not exactly sure what question is? However, I'm going to try to show you where some of the code that you can change is. First, I enabled the the Devel Theme module admin/modules (I use the the URI after yoursite.com/ do describe where you should be). The I went back to the front page and click in the bottom left corner on the box that says theme. The Devel module acts like firebug. I assume that you are using firebug to change the CSS for testing. The devel module gives me a list of functions, .tpl.php files, and preprocess functions used. That is one way to go about it.

The quicker way (I mentioned the method above because you should know how to do that) is to like on the link that pops up when your are logged in as admin that says configure edit view. Click on 'edit view'. (I'm not sure why but it doesn't go to that instance of the view.) It will take you here admin/build/views/edit/blogs?destination=node. Notice on the left it says defaults, blog page, home page block? Click on home page block which will give the information for that view. The next column over is called in small bold letters default. At the bottom of that list are the words theme: information. Click on information which is blue. This will give you the default names of the .tpl.php files that are used at the beginning of every list and to the right of them the names of potential overrides files that you can put in your active theme directory. Make sure to hit the 'rescan template files' it is acting very freaky. (Good thing you know how to use method one listed above.)

The default file views-view-unformatted.tpl.php has been overridden with a similar file called views-view-unformatted--blogs--block-2.tpl.php. You need to find that file in your theme directory at sites/all/themes/openpublish_theme_views/blogs/views-view-unformatted--blogs--block-2.tpl.php and open it. It will look like this:

<h3><?php print l('Blogs', $view->display['page_1']->display_options['path']); ?></h3>

<?php foreach ($rows as $id => $row): ?>
  <div class="<?php print $classes[$id]; ?>">
    <?php print $row; ?>
  </div>
  <?php if (stripos($classes[$id],'views-row-last') === false): ?><div class="views-separator"></div><?php endif; ?>
<?php endforeach; ?>

I'm not sure what you want to do with it but that l() function at the top creates the link. You can throw in some css classes in that code to do your biding.

If you click on the blue link in the templates section of views you will get the default code for that view which you can copy to a file to override it using one of the suggestion override names. For example here is default code for the view that you want to work with. Can you see the difference?

<?php
// $Id: views-view-unformatted.tpl.php,v 1.6 2008/10/01 20:52:11 merlinofchaos Exp $
/**
* @file views-view-unformatted.tpl.php
* Default simple view template to display a list of rows.
*
* @ingroup views_templates
*/
?>

<?php if (!empty($title)): ?>
  <h3><?php print $title; ?></h3>
<?php endif; ?>
<?php foreach ($rows as $id => $row): ?>
  <div class="<?php print $classes[$id]; ?>">
    <?php print $row; ?>
  </div>
<?php endforeach; ?>

Marine job board with Drupal 7 at http://windwardjobs.com

Thank you for the explanation

pkcho's picture

I will look at this later tonight.

Basically, I want the Homepage Blogs block title (and Multimedia block title) to behave like every other block title on the site, to not be linked. I just want it to be a display title. Because it links, the text color changes when it is clicked and therefore does not match the titles of the other blocks. Plus I don't need that behavior for that block.

Thanks.

I would delete

Adam S's picture

I would delete sites/all/themes/openpublish_theme_views/blogs/views-view-unformatted--blogs--block-2.tpl.php. You need to clear the theme registry via the devel module, which should be in a visible block somewhere, so that it rebuilds. I think if you goto modules and hit save it rebuild the theme registry too. This administration menu doens't have the devel module menu items like the old OpenPublish site did :(

Once this deleted it will revert back to the default view-unformatted-block.tpl.php file, which I think is the plain and simple one that you want. You can just rename the file so you have it just in case.

Marine job board with Drupal 7 at http://windwardjobs.com

That worked perfectly!

pkcho's picture

Thanks. I guess I should have figured that out, but I was too scared to play with template files : )

Can the link from a book menu

Diegen's picture

Can the link from a book menu block be removed too ?

OpenPublish

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: