WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Title Formating - href vs echo (3 posts)

  1. spowers33
    Member
    Posted 3 years ago #

    Trying to hack a theme to put the title where the theme typically has the date. Don't really know PHP, and educated guesses got me only so far. I got the title in place, with the link, but lose the formatting of the original.

    So I included both lines of code below. The first, with href, has the title and the link, but I can't get the CSS formating to transfer. The second, with echo, is the original code that publishes the date - with no link. Any suggestions to get the href code to work, but keep the formatting of the echo line, will be definitely appreciated.

    <!-- Blog Post -->
            <div class="ribbon">
            <div class="wrapAround"></div>
            <div class="tab">
                    <a href="<?php echo get_permalink(); ?>" class="blogDate"><?php echo get_the_title();  ?></a>
                    <div class="blogDate"><?php echo ' <span class="blogDate">'. get_the_title() .'</span> '; ?></div>

    I put both lines on my site for now, which is http://www.myfriendsareretarded.com. Thanks again.

  2. alchymyth
    Forum Moderator
    Posted 3 years ago #

    try and consolidate this:

    <a href="<?php echo get_permalink(); ?>" class="blogDate"><?php echo get_the_title();  ?></a>
                    <div class="blogDate"><?php echo ' <span class="blogDate">'. get_the_title() .'</span> '; ?></div>

    into this:

    <div class="blogDate"><span class="blogDate"><a href="<?php the_permalink(); ?>" class="blogDate"><?php the_title(); ?></a></span></div>

  3. spowers33
    Member
    Posted 3 years ago #

    What took you moments, would have taken me numerous hours and Tylenol. Thank you so much, it worked beautifully.

Topic Closed

This topic has been closed to new replies.

About this Topic