Site logo

Archived topic

Custom Field: Where does php go in Generate Press tools?

17 replies · Started by Tom on February 8, 2022

Viewing posts 16–18 of 18

Add this PHP snippet to your child theme's function.php or to the Code snippet plugin:

function apply_link_shortcode() {
   $apply_link = get_field( 'apply_link' );
    if ( $apply_link) {
        echo '<a class=button apply-link-button'.' href=' .$apply_link. '>Click to Apply</a>';
    }
}
add_shortcode( 'apply_link', 'apply_link_shortcode' );

You can use this shortcode[apply_link].

And you can target this CSS class .button.apply-link-button to style the button.

Thank you Ying. I will try that.

You are welcome :)

This archived topic is closed to new replies.