Is there some way to remove the link from the title of a sticky post? I know I can use the following css to remove *all* titles, but I want to retain the title links for all other posts.

Do I need to do this in the style.css of bluemarine or the page.tpl.php? I am using the php version of the bluemarine theme.

Comments

venkat-rk’s picture

I added the following in node.tpl.php:

<?php if ($sticky) { ?><h2 class="title"><?php print $title?></h2><?php } ?>

but the result was that I got another title below the original one, though without the link.

behindthepage’s picture

I think you are nearly there. I assume you put that line below the standard h2 title line in node.tpl.php.

Here is the logic I would use instead

If (sticky) { print only title} else {print normal title with link}

I would need to see your code for node.tpl.php to be more specific.

gpdinoz
"If you're not getting the answers you want maybe you're asking the wrong questions"

Regards
Geoff

venkat-rk’s picture

Thank you, gpdinoz. You are right. I put that line below the standard h2 title line.

I realised that it needs to be an if else statement, but I don't know how to combine the two. Here is the full code from my node.tpl.php:

 <div class="node<?php if ($sticky) { print " sticky"; } ?>">
    <?php if ($picture) { 
      print $picture;
    }?>
    <?php if ($main) { ?><h2 class="title"><a href="/<?php print $node_url?>"><?php print $title?></a></h2><?php } ?>
    <?php if ($sticky) { ?><h2 class="title"><?php print $title?></h2><?php } ?>
    <span class="submitted"><?php print $submitted?></span>
    <span class="taxonomy"><?php print $terms?></span>
    <div class="content"><?php print $content?></div>
    <div class="links">&raquo; <?php print $links?></div>
  </div>
behindthepage’s picture

Let me know if you have any problems with this.

<div class="node <?php if ($sticky) { print " sticky"; } ?> ">
     <?php if ($picture) { print $picture; }?>
    <?php if ($sticky) { ?> <h2 class="title"> <?php print $title; ?> </h2> <?php } elseif ($main) { ?>
    <h2 class="title"><a href="/ <?php print $node_url?> ">
    <?php print $title?></a></h2><?php } ?>
<span class="submitted"> <?php print $submitted?> </span>
    <span class="taxonomy"> <?php print $terms?> </span>
    <div class="content"> <?php print $content?> </div>
    <div class="links">&raquo; <?php print $links?> </div>
  </div>

This is a good idea. I will probably use this sometime in the future.

Regards
gpdinoz
"If you're not getting the answers you want maybe you're asking the wrong questions"

Regards
Geoff

venkat-rk’s picture

Thanks!

But, it still prints out the double headline and retains the link. I noticed that, in page.tpl.php, there is only a h1 class, so I changed this to h1 in your code, but still no result. You can see it here.

www.ciosa.org.in/beta2

behindthepage’s picture

I tested it on the bluemarine theme and taxonomy/term/6 page and it worked. What sort of posts page is it? Blog? story?Taxonomy?

Have you edited page.tpl.php? What modules have you got enabled?

gpdinoz
Thought for the day
"If you're not getting the answers you want maybe you're asking the wrong questions"

Regards
Geoff

venkat-rk’s picture

It is a story content type and it is on node, which I have designated as the front page of the site.

But, it is also tagged with taxonomy terms.

I didn't edit the page.tpl.php. Only did it on node.tpl.php? Could that be the reason?

behindthepage’s picture

<div class="node <?php if ($sticky) { print " sticky"; } ?> ">
     <?php if ($picture) { print $picture; }?>
    <?php if ($sticky) { ?> <h2 class="title"> <?php print $title; ?> </h2> <?php } else { ?>
    <h2 class="title"><a href="/ <?php print $node_url?> ">
    <?php print $title?></a></h2><?php } ?>
<span class="submitted"> <?php print $submitted?> </span>
    <span class="taxonomy"> <?php print $terms?> </span>
    <div class="content"> <?php print $content?> </div>
    <div class="links">&raquo; <?php print $links?> </div>
  </div>

gpdinoz
Thought for the day
"If you're not getting the answers you want maybe you're asking the wrong questions"

Regards
Geoff

.carey’s picture

... My stickys no longer have links.

But I'd like to add something to it but I don't know how. My page titles have links which seems completely unnecessary. Is there anyway to add something to this code that says that page titles will not have links as well as stickys but story and blog titles will?

Thanks,
Carey

venkat-rk’s picture

I am sure what you want can be done with some php code, but I still haven't learned enough to try:(

behindthepage’s picture

You only need to edit node.tpl.php.

Have you used a php snippet to do this? what is the path (in the settings) to the node that you are using as the front page.

What version are you using?

I have accomplished exactly what you are trying to do on a couple of my test sites but it doesn't seem to work on your site so something must be different.

gpdinoz
"If we can see further it is because we stand on the shoulders of giants"

Regards
Geoff

venkat-rk’s picture

Wow, your latest code works perfectly with the phptemplate version of bluemarine! Thanks a ton.

Apparently, you have to visit admin>>themes to get phptemplate to refresh its cache in order to recognise any changes to the .tpl.php files.

I just realised that this is an incredibly useful way to have an introductory paragraph for a taxonomy term page. Just change the node.tpl.php file, create a node, mark it sticky, tag it with a taxonomy term and you're done.

Thank you once again.

behindthepage’s picture

I was starting to get worried.

Yes it is a great idea. I will definately be using this in the future.

gpdinoz
"If we can see further it is because we stand on the shoulders of giants"

Regards
Geoff