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
Try this :
<a href="<?php bloginfo('template_url'); ?>/admin.php">Admin</a>
Another way is to create template in wordpress theme folder
<?php
/*
Template Name: templatename
*/
?>
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
You need to use the full path.
In order to get url of the home page,
use this.
<a href="<?php bloginfo('site_url'); ?>/admin">Admin</a>
to get file use this.
<a href="<?php bloginfo('template_url'); ?>/admin/admin.php">Admin</a>
For more information about the bloginfo
See this url -> https://developer.wordpress.org/reference/functions/bloginfo/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.