[Resolved] Change text (author and date) under blog titles

Home Forums Support [Resolved] Change text (author and date) under blog titles

Home Forums Support Change text (author and date) under blog titles

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #702940
    thomas

    Hello,
    Do you know a snippets to change date and author text?
    actually I have date “by” author, I would like : “publié le” date “par” author
    Does it makes sense ?

    Thanks for your help
    Thomas

    #703422
    Leo
    Staff
    Customer Support

    Hi there,

    Is this is more like a translation?

    Have you considered using a translator plugin like Polylang or WPML?

    Let me know if I’m missing something 🙂

    #703437
    thomas

    On this page : http://www.ageca.org/category/blog/
    Under titles I have “15 octobre 2018 de Georges mr” (date by author)
    I want to change it with another text : “published the ‘date’ by ‘author'”
    I don’t want a translation, I want to add text before and after the date.

    #703514
    Leo
    Staff
    Customer Support

    Try this CSS:

    .posted-on .published:before {
        content: "Published ";
    }

    Let me know 🙂

    #704063
    thomas

    It works perfectly for the text before the date, thanks!
    I’d also like to change the text just before the author name : “by” with something else like “published by ”
    Thanks for your help!

    #704267
    Leo
    Staff
    Customer Support

    Little tougher but this PHP snippet should work:

    add_filter( 'generate_post_author_output', 'tu_remove_by_byline' );
    function tu_remove_by_byline() {
    	printf( ' <span class="byline">%1$s</span>', // WPCS: XSS ok, sanitization ok.
    		sprintf( '<span class="author vcard" itemtype="https://schema.org/Person" itemscope="itemscope" itemprop="author">%1$s <a class="url fn n" href="%2$s" title="%3$s" rel="author" itemprop="url"><span class="author-name" itemprop="name">%4$s</span></a></span>',
    					__( 'Publish by', 'generatepress' ),
    			esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    			/* translators: 1: Author name */
    			esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ), get_the_author() ) ),
    			esc_html( get_the_author() )
    		)
    	);
    }

    Adding PHP: https://docs.generatepress.com/article/adding-php/

    #704310
    thomas

    Awesome thanks!

    #704315
    Leo
    Staff
    Customer Support

    No problem 🙂

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.