My question is regarding using the_field with Page Links. When I use:
<?php the_field('page_link'); ?>
or <?php echo get_field('page_link'); ?>
The value returned can be used like this: <a href="<?php the_field('page_link'); ?>">Read this!</a>
However, what want to return is the page name of the post being linked. In other words what I want to do is:
<a href="<?php the_field('page_link'); ?>"><?php SOME OTHER CODE ?>!</a>
Where the second function returns the name of the page being linked to rather than just the url.
Use the post object field instead!
It’ll give you the entire post object (duh) instead of just a link.
<?php $postobject = get_field('post_object'); ?>
<a href="<?php echo get_permalink($postobject->ID); ?>"><?php echo $postobject->post_title; ?></a>