• Resolved thisisedie

    (@thisisedie)


    I’ve tried, and tried, and tried, and tried to get this to work and can’t figure out what I’m doing wrong. What I want is to have the title but not the date on the single.php for a certain category. This is what I’m using:

    <?php
    if (in_category('7')) {
    echo "<p><span class=\"title\"><a href=\"<?php the_permalink() ?>\" rel=\"bookmark\" title=\"Permanent Link to <?php the_title(); ?>\"><?php the_title(); ?></a></span></p>";
    
    } else {
    
    echo "<p><span class=\"title\"><a href=\"<?php the_permalink() ?>\" rel=\"bookmark\" title=\"Permanent Link to <?php the_title(); ?>\"><?php the_title(); ?></a></span><br />
    <span class=\"date\"><?php the_time('l') ?> — <?php the_time('F jS Y') ?></span></p>";
    } ?>

    The title/date comes up blank and shows the actual code in the source. I know it’s because I’m trying to implement a php statement within a php statement and I’ve tried doing it the ways I’ve found on a zillion different sites but nothing works. Good grief this is a simple thing but I can’t seem to wrap my brain around it. Sigh. Anyone have any ideas?

Viewing 1 replies (of 1 total)
  • Thread Starter thisisedie

    (@thisisedie)

    Figured it out. Here’s the solution if anyone’s interested:

    <?php
    if (in_category('7')) { ?>
    <p><span class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></span></p>
    
    <?php } else { ?>
    
    <p><span class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></span><br />
    <span class="date"><?php the_time('l') ?> — <?php the_time('F jS Y') ?></span></p>
    <?php } ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Custom Titles For Single.php’ is closed to new replies.