I am trying to implement a page that displays blog posts by tag using a WordPress loop. The problem that I've been running into is setting the tag to display as the page title. Here is the code that I've tried so far.
<?php query_posts('tag=aetna'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div class="page-content ">
<?php the_content() ;?>
</div>
<?php endwhile; endif ;?>
This code works just fine. However, when I try to assign the tag to the page title, it doesn't work. Here is the code I've tried for that. I'm new to PHP so I'm hoping this is just a silly syntax thing.
<?php $tag=strtolower(the_title()); ?>
<?php query_posts('tag=$tag'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div class="page-content ">
<?php the_content() ;?>
</div>
<?php endwhile; endif ;?>
Any help you can provide me is much appreciated. Thank you!