Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to give hyperlink in wordpress

I am writing code in my wordpress themes folder. i am giving hyperlink to another page from my index page but its not working.

     <li><a href="admin/admin.php"> Admin </a></li>

Link is not working like this

I am new to wordpress. Can anybody help me with this.

Thanks in advance

like image 963
komal deep singh chahal Avatar asked Dec 05 '25 07:12

komal deep singh chahal


1 Answers

You have to use full path for that link, so, that would be http://site-url/slug. You can achieve that by using following code.

<li><a href="<?php echo site_url();?>/admin/admin.php"> Admin </a></li>

The site_url template tag retrieves the site url for the current site (where the WordPress core files reside) with the appropriate protocol, 'https' if is_ssl() and 'http' otherwise.

You can read more about site_url

like image 170
Mukesh Ram Avatar answered Dec 06 '25 21:12

Mukesh Ram



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!