WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Where is the code located to remove the date link? (8 posts)

  1. Bubble Wrapped
    Member
    Posted 2 years ago #

    Two questions:

    I'm using the Twenty-Eleven Theme and have spent a considerable amount of time trying to find where the code is located that turns the date under the post titles into a link. I've checked everything. I want to keep the date, but remove the link.

    Also, this sounds silly, but when I changed some basic things like fonts and font colors, the bubble image for the comments to the right of my post titles stopped loading. Now it only shows a gray box. My mom really wants to keep the bubble/cloud image that surrounds the number of comments, so I'd love to figure out what I did incorrectly.

    Here's the website link:

    WEBSITE LINK!!

    Thank you for any help you can provide me with.

  2. Bubble Wrapped
    Member
    Posted 2 years ago #

    Hopefully someone can contribute soon. Thanks!

  3. Bubble Wrapped
    Member
    Posted 2 years ago #

    Never mind about the comments bubble image. I decided to remove it altogether. But that darn bit of code that controls the entry date meta link ... totally confounding. Ugh.

  4. Kudos on using a child theme. :)

    In your twentyeleven-child/style.css file, try adding these lines at the bottom of your theme's style.css

    .entry-date, .sep {
       display: none;
    }

    That should prevent the "Posted on ..." from being displayed.

    Edit: Ha! I misread. Again. You want the date but not the link.

  5. One reason Twenty Eleven is a great theme is that the parent theme functions.php file runs after the child theme's functions.php.

    That's normal for all child themes but the Twenty Eleven theme checks if a function is defined before trying to define it. That's cool and lets you re-define functions easily in the child theme.

    If you don't already have a twentyeleven-child/functions.php file, create one and add these lines to it. This will display the "Posted on ..." but without a link.

    <?php
    
    function twentyeleven_posted_on() {
            printf( __( '<span class="sep">Posted on </span><time class="entry-date" datetime="%3$s" pubdate>%4$s</time><span class="by-author"> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span>', 'twentyeleven' ),
                    esc_url( get_permalink() ),
                    esc_attr( get_the_time() ),
                    esc_attr( get_the_date( 'c' ) ),
                    esc_html( get_the_date() ),
                    esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
                    esc_attr( sprintf( __( 'View all posts by %s', 'twentyeleven' ), get_the_author() ) ),
                    get_the_author()
            );
    }

    I'm really pushing the limit on lines of code, so just in case here's the pastebin.com link.

    http://pastebin.com/jeusSKR5

    If you do have a functions.php already, them leave out the <?php and paste in the rest.

  6. Bubble Wrapped
    Member
    Posted 2 years ago #

    Hi Jan!

    I wanted to thank you for taking the time to help me with this. You resolved the problem perfectly, and you also helped with another question: adding a function.php file to my child theme. It was as easy as you described. I'm still not clear on functions, but I'm grateful that you stepped up and helped me out.

    By the way, I would have thanked you sooner, but I didn't receive an emailed notification that someone had responded to my question.

    Have a great day!

  7. You're welcome, glad to help. :)

    Could you mark this resolved? I'm collecting them on my cafeteria ticket. Two more for the free soup with lunch!

  8. actheuniv
    Member
    Posted 2 years ago #

    Hi, I tried to solve the same problem and your solution worked perfectly, Jan! Thank you so much. For the newbees just like me: When you create functions.php for your child theme, you DON'T need to copy-paste all the codes from functions.php of the parents theme. Just open a text editor, write

    <?php
    ?>

    then you've already opened & closed a php file. Then just copy-paste what Jan wrote from
    function twentyeleven_posted_on() {
    to
    }
    between <?php and ?>.
    The other thread about functions.php helped me a lot understanding functions.php, too.

Topic Closed

This topic has been closed to new replies.

About this Topic