Get ACF Page Link Data

Categories:
Published On:
Reading Time:
1 Minute

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;
}
PHP
Sigma 1 Logo

Signup For Our Newsletter

Stay up to date with the newest trends in technology, exclusive offers & discounts from our company, and new products and services that we are offering.

Want to Hire Us For Your Next Project?

We work with all different types of companies from around the world with one goal in mind - to help them grow their brand and acquire new customers.
Contact Us

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;
}
PHP
Sigma 1 Logo

Signup For Our Newsletter

Stay up to date with the newest trends in technology, exclusive offers & discounts from our company, and new products and services that we are offering.

Want to Hire Us For Your Next Project?

We work with all different types of companies from around the world with one goal in mind - to help them grow their brand and acquire new customers.
Contact Us
Dimitri is is a full-stack developer and the founder of Sigma 1. He spends the majority of his time designing websites for customers. However, when he has a bit of free time, you can catch him on a hike or exploring the nature around Las Vegas.

Leave a Reply

Your email address will not be published. Required fields are marked *

Leave a Reply

Your email address will not be published. Required fields are marked *