Reputation:
I have no idea why this is not working
<?php $title = the_title(); ?>
<h1 class="top-entry-title">
<?php if( $title === "News" ): ?>
<?php the_title(); ?>
<?php endif; ?></h1>
it just shows the title for every page even if it isn't equal to news ?
Upvotes: 0
Views: 73
Reputation: 1381
You can use this:
<?php the_title( '<h1>', '</h1>' ); ?>
This would print the title to the screen as an h1.
Read here wordpress doc Codex
Upvotes: 0
Reputation: 1385
There's no echo
in your code (and it's way too complicated, I think):
<?php
if( $title === "News" )
echo "News";
?>
should do the job.
Upvotes: 0
Reputation: 33521
The problem is in the top.
$title = the_title();
will print the title. See also the Wordpress Codex.
Upvotes: 1