I have a website with several pages with links/buttons that should lead to a specific page. Is there a way to link this buttons in a dynamic way, that does not include page ID?
Currently I am doing it this way, with ACF field in which I write in a page ID
<div class="projects-homepage-item">
<?php $projects_page = get_post(get_field('page_id')); ?>
<a href="<?php the_permalink($projects_page->ID); ?>" class="projects-homepage-item-img" target="_blank">
<?php the_post_thumbnail(); ?>
</a>
</div>
Is there something similar to this function that leads to blog/post page?
<div class="news-homepage-btn-wrapper">
<a href="<?php echo esc_url(get_permalink(get_option('page_for_posts'))); ?>" target="_blank" class="news-homepage-btn"><?php printf(__('Pogledaj sve novosti', 'femix')); ?></a>
</div>