Store and reteieve page urls

[ad_1]

I’m building a classic php theme and am running into a problem.

Say I have a page /about/

I link to the page in my navbar, footer and maybe a few other places like this href=”echo esc_url(site_url(‘/about’));”

It works good, however , if I change the slug in any way, i would have to change this function parameter three places.

Id like to store this in a function or something, and refer to this function instead of the hardcoded ‘/about’

And then when changes need to be made, only Change it one place.

Any suggestion of a clean implementation?

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer