ACF is a great plugin that allows you to make dynamic websites with ease. When we have a client that wants to manage, update and add new content to their website we set up ACF so they can manage it with ease. One field we like to use is the "Page Link" field that allows them to select a page that they want a page or a button to link to. Using this field is slightly different and less straightforward than the others.
Here is the code:
function sigma1_get_button_link($button_id){
$page_id = get_field($button_id, false, false );
if( $page_id ):
return get_the_permalink( $page_id );
echo get_the_title( $page_id );
endif;
}
ACF is a great plugin that allows you to make dynamic websites with ease. When we have a client that wants to manage, update and add new content to their website we set up ACF so they can manage it with ease. One field we like to use is the "Page Link" field that allows them to select a page that they want a page or a button to link to. Using this field is slightly different and less straightforward than the others.
Here is the code:
function sigma1_get_button_link($button_id){
$page_id = get_field($button_id, false, false );
if( $page_id ):
return get_the_permalink( $page_id );
echo get_the_title( $page_id );
endif;
}