Changing Staff Post Button on Archive Page

Home Forums Icelander Changing Staff Post Button on Archive Page

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #16975

    alexandra.h
    Participant

    Changing Staff Post Button on Archive Page

    Resolved

    Hi,

    For the Archive Page for Staff Posts, is there a way to change the text on the button from “Nice to Meet you” to something else?

    I’m hoping to change the text to “Read bio”.

    Thank you

    #16976

    Oliver Juhas
    Keymaster

    Hi alexandra.h,

    Please note that you can do this in your child theme‘s functions.php file using this code (change the text in there to your needs):

    /**
     * Setting up a child theme and overriding the parent theme
     */
    function child_theme_setup() {
    
    	// Processing
    
    		// Remove actions
    
    			remove_action( 'tha_entry_content_after', 'Icelander_WebMan_Amplifier_Custom_Post_Types::staff_more_link' );
    
    		// Add actions
    
    			add_action( 'tha_entry_content_after', 'child_theme_staff_more_link' );
    
    } // /child_theme_setup
    
    add_action( 'after_setup_theme', 'child_theme_setup', 100 );
    
    /**
     * Custom Staff post "Read more" link
     */
    function child_theme_staff_more_link() {
    
    	// Requirements check
    
    		if ( is_single( get_the_ID() ) || 'wm_staff' !== get_post_type() ) {
    			return;
    		}
    
    	// Output
    
    		if ( trim( get_the_content() ) ) {
    
    			echo '<a href="' . esc_url( get_permalink( get_the_ID() ) ) . '" class="button" rel="bookmark">';
    			esc_html_e( 'Nice to meet you!', 'icelander' );
    			echo '</a>';
    
    		}
    
    } // /child_theme_staff_more_link

    Best regards,

    Oliver Juhas
    WebMan Design

    • This reply was modified 2 months, 3 weeks ago by  Oliver Juhas. Reason: Fixing `remove_action`
    #16977

    alexandra.h
    Participant

    Amazing, thank you!

    Just caught one error – should be remove_action to remove the first button.

    Best,

    #16979

    Oliver Juhas
    Keymaster

    Hi alexandra.h,

    Thank you for spotting the error in the code! Indeed, you are right. I have fixed it now.

    Best regards,

    Oliver Juhas
    WebMan Design

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

You must be logged in to reply to this topic.