[Resolved] Blog Post Bio & Previous Article Links

Home Forums Support [Resolved] Blog Post Bio & Previous Article Links

Home Forums Support Blog Post Bio & Previous Article Links

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #2233051
    Shaun

    Hi

    I have two different queries about blog posts on a website I am building.

    1. Author Bio Boxes
    I am setting up a website. Different people will write blog posts. I have created a GP Element (Block, After Content, Posts [see attached]) for an Author bio block. But I need to specify that only articles written by author X, show an author X bio block. Then only articles written by Author Y show an Author Y bia box etc. How can I do this?

    2. Previous article links
    At the bottom of the articles are some meta links to the next/previous article (see attached). How do I remove the?

    Author Bio & Bottom Meta

    #2233054
    Shaun

    The image URL didn’t work, but you see both the author box and bottom meta at the bottom of the link I shared in the Private Information field

    #2233095
    Fernando
    Customer Support

    Hi Shaun,

    1. This is possible through a PHP snippet. Here is an article you may refer to: https://docs.generatepress.com/article/generate_element_display/#display-an-element-to-a-specific-author

    A sample code would be:

    add_filter( 'generate_block_element_display', function( $display, $element_id ) {
        $author_id = get_post_field( 'post_author', get_the_ID() );
    
        if ( 394755 === $element_id && '1' == $author_id && is_single() ) {
            $display = true;
        } else if ( 394755 === $element_id && ‘1’ == $author_id && is_single() ) {
    	$display = false;
    }
    
        return $display;
    }, 15, 2 );

    Adding PHP reference: https://docs.generatepress.com/article/adding-php/#code-snippets

    Kindly replace 394755 with the Element ID and 1 with the author ID.

    2. Which are you planning to remove? The sentence seems cut off.

    Kindly let us know.

    #2234506
    Shaun

    Thanks Fernando

    Re issue 1 (the author bio element)

    I have two queries
    1a. I added the sample code to https://holidayparks.websmall.net/forest-flying-finch-hatton-gorge/ and my author bio element shows.
    Yet it still shows for another user (still me but as a separate Admin user) see https://holidayparks.websmall.net/blacks-beach-mackay/
    1b. Do I repeat the code you gave me for each author?

    Re Issue 2
    Sorry – my question was cut off. I want to remove the next/previous meta – see (https://drive.google.com/file/d/1qw1S5OGiHoleG9sb79xeHMwdkWFPsHif/view?usp=sharing)
    you can also see the meta at the bottom of the two blog posts I shared in issue 1.

    Thanks
    Shaun

    #2234909
    David
    Staff
    Customer Support

    Hi there,

    on the author box… the Method that Fernando provided assumes you have a separate block element for each author.

    Question – will the various authors have their own user profile? As if they do you should be able to use 1 dynamic block element for all of them. Let me know.

    #2235792
    Shaun

    Hi David
    Thx for your response.
    Yes, the different Authors will have their own user profile.
    Cheers
    Shaun

    #2236328
    David
    Staff
    Customer Support

    This video explains how to add a dynamic author box, that method would mean one Element for all authors.

    https://www.youtube.com/watch?v=4x6CjGOyagc&t=9s

    #2236454
    Shaun

    Thx David
    Other than GP being a great product, you and the rest of the support team offer far better service than I have received anywhere else.
    Do you have any advice regarding removing the Next post meta at the bottom of each post as above?

    #2236765
    David
    Staff
    Customer Support

    Thank you 🙂

    You can use a PHP Snippet to remove just that item.

    add_filter( 'generate_header_entry_meta_items', function( $items ) {
        return array_diff( $items, array( 'post-navigation' ) );
    } );

    OR if you’re using a Block Element to create your Post Meta:

    https://docs.generatepress.com/article/block-element-post-meta-template/

    When you select After Content you have the option to replace the theme secondary meta which includes the categories and post navigation.
    So you can, if it works for your layout, create a footer meta with your Author box, and any other meta to replace the existing theme one.

    #2237276
    Shaun

    Thx David

    #2237641
    David
    Staff
    Customer Support
Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.