WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Where is the code located to remove the date link?

[Resolved] Where is the code located to remove the date link?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hopefully someone can contribute soon. Thanks!

    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.

    Moderator Jan Dembowski

    @jdembowski

    Brute Squad and Volunteer Moderator

    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.

    Moderator Jan Dembowski

    @jdembowski

    Brute Squad and Volunteer Moderator

    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.

    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!

    Moderator Jan Dembowski

    @jdembowski

    Brute Squad and Volunteer Moderator

    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!

    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.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] Where is the code located to remove the date link?’ is closed to new replies.
Skip to toolbar