Changing "by" to "posted by"

  • keikoflower

    #5522

    Hi, I have no idea how to change this. The client I’m working for is not the author of all the articles he’s posting and so would like it to say “posted by” instead of “by” in the byline. I assume that you’d change it in the child theme somehow but I can’t find the code using firebug 🙁

    help!

    Prasanna SP

    #32118

    If you are familiar with php, try adding this to your child theme’s functions.php file,

    function graphene_filter_gettext( $translated, $original, $domain ) {
    $strings = array(
    'by %s' => 'posted by %s',
    );
    if ( ! empty( $strings[$original] ) ) {
    $translations = &get_translations_for_domain( $domain );
    $translated = $translations->translate( $strings[$original] );
    }
    return $translated;
    }
    add_filter( 'gettext', 'graphene_filter_gettext', 10, 3 );

    keikoflower

    #32119

    Hi, thank you for your reply and the code you provided however, I can’t seem to make it work. I put it where you mentioned but the text ended up at the top of my screen in the back end of the site for some reason. Did I put it in the wrong spot?

    I went: Editor / Theme functions and just put the code there. I can send a screen grab of what it looks like if you like.

    thanks so much for your help!

    keiko

    Mod

    Kenneth John Odle

    #32120
    Quote:
    I went: Editor / Theme functions and just put the code there.

    Nope. You never want to edit theme files, because any changes you make will be lost in the next update. As Graphene is in active development, updates come often.

    You need to create a child theme and add Prasanna’s code to your child theme’s functions file. There are complete guides to implementing a child theme in this forum and on the Graphene theme wiki.

    Prasanna SP

    #32121

    Also, if your child theme functions.php file is empty, put the above function between opening and closing php tags. ie,

    <?php
    abode code
    ?>

    keikoflower

    #32122

    Oh no now I can’t get the admin screen to come back and I only get this text:

    Parse error: syntax error, unexpected T_STRING in /homepages/36/d105421224/htdocs/sugarworkers/wp-content/themes/graphene-child/functions.php on line 2

    this is after I added the above code ’cause I didn’t have anything in the Graphene child functions area. Help!

    k

    keikoflower

    #32123

    double oh no, the whole site is down and only get the same message above ahhhhh

    k

    keikoflower

    #32124

    Is there any way to fix this without going on the ftp? I don’t have access to it.

    Prasanna SP

    #32125

    Did you really put the code between opening and closing php tags? i.e <?php and ?>

    It gave me no error when I added the same code on my site. See this post – http://test2.prasannasp.net/test-post-18/

    Don’t you have access to cPanel or any other file manager?

    keikoflower

    #32126

    I thought that’s how I put in the code but now I don’t know. Thanks for your help. I have to wait for the person with FTP access to update it. I did put it in the child theme initially, so it should have been fine.

    keiko

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.