Good day:

I would like to disable the default behavior
of my page-top site-name,
so that it is no longer a hyperlink.

I assume this is not acheive-able using CSS.

Please; What file, and what line do I need to change/add?

Thanking you in advance for your attention, time, and help.

: o )

-chris

Comments

jdeg’s picture

The easiest way to remove the hyperlink is modifying your theme (page.tpl.php). Depending the theme you installed you will see something like:

<a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home" id="logo">
   <img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" />
</a>

You can change it to:

<img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" />
christopher james francis rodgers’s picture

@josedanielestrada:

Thank you very much for your reply and help. Your suggestion above has helped me to easily get the results I desired.

Your solution, however, removed the hyperlink-capability for the "Logo", whereas I wanted the hyperlink-capability removed from the "Site-name". Lucky for me, when I mimicked and applied your suggestion as follows, I got exactly what I wanted.

Thanks again, my friend.

===

To remove the hyper-link-capability of the Drupal 7 site-name

[Edited - 2015.02.03]

The following example was done using the theme
"Zen-7.x-3.3", but applies equally to "Zen-7.x-3.2"
since the page.tpl.php file is identical in both versions.

  1. Find your active "page.tpl.php" file.

    The location of the file "page.tpl.php"
    varies from theme to theme.

    The 'Zen base-theme' "page.tpl.php" file location is:
    [D7-root]/sites/all/themes/zen/templates/page.tpl.php

    If your sub-theme has its own "page.tpl.php" file,
    then that is the file that is actively being used;
    and the base-theme "page.tpl.php" file is ignored.

  2. Locate the following code (or similar): [Tip: Search for...
    id="site-name"]

                <div id="site-name"><strong>
                  <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home"><span><?php print $site_name; ?></span></a>
                </strong></div>
  3. Use "<!--" and "-->" (comment tags) to comment-out the following code:

    <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home">

    and also comment-out the code:

    </a>

    This is what it should look like:

                <div id="site-name"><strong>
    <!--
    <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home">
    -->
    <span><?php print $site_name; ?></span>
    <!--
    </a>
    -->
                </strong></div>
  4. "Clear all caches" for the changes to take effect:

    Navigate to the 'Performance' page.
    • 'Configuration' >> 'Development' >> 'Performance'
    • [D7-root]/admin/config/development/performance

    Click the button "Clear all caches".

 


All the best; intended.
-Chris (great-grandpa.com)
___
"The number one stated objective for Drupal is improving usability." ~Dries Buytaert *

jdeg’s picture

Great! :)

mikeaja’s picture

Just to correct something in the above post.

You do not need to 'Visit you Drupal 7 "Appearance" page so that the changes will take effect' when editing the page.tpl.php file. This is only necessary when editing the .info file.

christopher james francis rodgers’s picture

@ mikeaja

Thank you for having taken time to correct my original instructions.

I have edited my instructions above, and, among other things, I removed the 'Visit Appearance page' instructions.


All the best; intended.
-Chris (great-grandpa.com)
___
"The number one stated objective for Drupal is improving usability." ~Dries Buytaert *

opstao’s picture

We have a Bartik-based site with 5 tabbed sections, one of which is Home. We want to remove link behavior from the Site Name, as well as logo, on all pages. The above-suggested modification of page.tpl.php accomplishes that for 2 of the 5 pages (Home and a Main Content page), but not for the other 3 sections/pages. Those include Book-module formatted pages but also a page that's just a contact form. We considered looking into node--book.tpl.php" but found no similar code there to modify. (nothing that seems to relate to "site-name" or "site_name")

Is there a way to verify what template a particular page is using? Does anyone have a suggestion for how to remove the sitename link in a more universal way? --Thanks--