• Hi, I hope someone can help me!

    I use the theme “Twenty Eleven 1.2” and in any articles appear date and nickname! Example:
    “Posted on 30 october 2011 by minimatical”

    Date its ok, but I wanna remove “by minimatical” part.

    I try to delete some code in php page… but nothing! forum posts don’t help me! =/
    oh can I remove it?

    Thank you!

Viewing 15 replies - 1 through 15 (of 28 total)
  • Can you tell us which file you already removed code from? And, if known, what code you removed?

    Thread Starter minimatical

    (@minimatical)

    I have try to remove in “wp-app.php”:

    $post_author = (int) $user_ID;

    and in “wp-content\themes\twentyeleven” in page functions.php

    I have try to remove:

    esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    sprintf( esc_attr__( 'View all posts by %s', 'twentyeleven' ), get_the_author() ),
    esc_html( get_the_author() )

    but nothing change!

    Hi all,

    Due to the way in which the Twenty Eleven theme is coded, if you modify the twentyeleven_posted_on function directly, those changes will be reflected in all theme files that use this function.
    If you are certain that you want to completely remove that info, here’s the reworked function for you:

    function twentyeleven_posted_on() {
      printf( __( '<span class="sep">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s" pubdate>%4$s</time></a>', 'twentyeleven' ),
        esc_url( get_permalink() ),
        esc_attr( get_the_time() ),
        esc_attr( get_the_date( 'c' ) ),
        esc_html( get_the_date() ),
      );
    }

    Be careful not to delete the endif; command that comes after the closing curly bracket.

    Cheers!

    Do not edit the Twenty Eleven theme. It is the default WordPress 3.2 theme and having access to an unedited version of the theme is vital when dealing with a range of site issues. Create a child theme for your changes. Once your child theme is active, we should be able to help with the customisation.

    Esmi has a point: I had automatically assumed a child theme was in place, but now re-reading the original post, I realized there is no mention of a child-theme.
    If you have already made too many changes to it, you could rename the theme folder, edit the commented out theme info inside style.css, and re-upload an unedited version of the original Twenty Eleven theme. That way you can keep both the original theme and your customized version.
    Cheers!

    Marventus

    (@marventus)

    Hi,

    Where you able to figure this out? Do you need additional assistance?
    Let us know.

    Thanks!

    Thread Starter minimatical

    (@minimatical)

    Realy thank you for the Reply!!
    I have never create a Child Theme, so it is my first!

    so I have create a new folder:
    wp-content/themes/twentyeleven-child-theme
    and I have put in it two files:

    style.css
    it’s the same of “twentyeleven” just change the “Theme Name” in the code.

    functions.php
    with that code in it:

    <?php
    
    function twentyeleven_posted_on() {
      printf( __( '<span class="sep">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s" pubdate>%4$s</time></a>', 'twentyeleven' ),
        esc_url( get_permalink() ),
        esc_attr( get_the_time() ),
        esc_attr( get_the_date( 'c' ) ),
        esc_html( get_the_date() ),
      );
    }
    
    ?>

    I don’t know if it is the right procedure… for now nothing change in my website! =P

    P.S.
    Sorry for my bad english

    Marventus

    (@marventus)

    Hi,

    The problem with your approach is that your child theme is still using your original themes’ functions, including the original twentyeleven_posted_on. Even if you renamed your custom function, it would not work, because the template files would still be calling the original function’s name.

    I also don’t think it’s possible to modify the output of the original function, since it has no hooks you could use (Esmi, please correct me here if I’m wrong).

    I think the easiest solution would be to keep your modified TwentyEleven theme in a different folder inside themes, assign it a different name in the style.css file, and make all the changes you need directly. To rename the theme, try to locate this text at the beginning of that file style.css file:

    /*
    Theme Name: Twenty Eleven

    Change it to Twenty Eleven (custom) so you can individualize it in the Admin Panel.

    Of course, it is advisable as Esmi said to keep the original TwentyEleven theme unmodified so that you can reference it if you encounter any problems.

    Thread Starter minimatical

    (@minimatical)

    Now in my wp-content/themes I have this folders:

    – “twentyeleven” (with all the original files)
    – “twentyeleven-child-theme” (my new-custom folder).

    In this folder I have put 5 files:
    style.css its equal to the original but I have just change that:

    /*
    Theme Name: Twenty Eleven (Child Theme)

    and I have change the same line also in this files: editor-style.css, editor-style-rtl.css and rtl.css.

    and in functions.php I have just put your code:

    <?php
    
    function twentyeleven_posted_on() {
      printf( __( '<span class="sep">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s" pubdate>%4$s</time></a>', 'twentyeleven' ),
        esc_url( get_permalink() ),
        esc_attr( get_the_time() ),
        esc_attr( get_the_date( 'c' ) ),
        esc_html( get_the_date() ),
      );
    }
    
    ?>

    I have clean my cache browser and go in admin pannel, but I can’t see my custom theme. Just “Twenty Eleven 1.2” (the original) like default.

    Michael

    (@alchymyth)

    style.css its equal to the original but I have just change that:

    /*
    Theme Name: Twenty Eleven (Child Theme)

    you need to change more than that; – see https://codex.www.ads-software.com/Child_Themes#The_required_style.css_file

    particularly, you need to have this line:

    Template:       twentyeleven

    Thread Starter minimatical

    (@minimatical)

    Thank you alchymyth !
    I have add this line in style.css:
    Template: twentyeleven
    and now I can see my custom theme in admin pannel!

    But…when I going to active it… all my website go in crash!
    and give me this message:

    Parse error: syntax error, unexpected ‘)’ in /web/htdocs/www.mywebsite.com/home/wp-content/themes/twentyeleven-child-theme/functions.php on line 9

    Thread Starter minimatical

    (@minimatical)

    So it is something wrong in my functions.php

    Michael

    (@alchymyth)

    there is a comma too much in the code, at the end of this line esc_html( get_the_date() ), – the comma needs to be removed;

    corrected:

    <?php
    
    function twentyeleven_posted_on() {
      printf( __( '<span class="sep">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s" pubdate>%4$s</time></a>', 'twentyeleven' ),
        esc_url( get_permalink() ),
        esc_attr( get_the_time() ),
        esc_attr( get_the_date( 'c' ) ),
        esc_html( get_the_date() )
      );
    }
    
    ?>
    Marventus

    (@marventus)

    Oops, that was my bad,

    I was moving the arguments around and left an extra comma in the code.
    The corrected version should work.

    Sorry about that!

    Thread Starter minimatical

    (@minimatical)

    Oh yesss!!! now all working good!!
    Realy thank you!!! have a good day

Viewing 15 replies - 1 through 15 (of 28 total)
  • The topic ‘Twenty Eleven – Remove "Posted by …"’ is closed to new replies.