Home > database >  How to call .hmtl file inside the header.php in wordpress?
How to call .hmtl file inside the header.php in wordpress?

Time:06-23

I have finish all my html pages and now I want to add them inside the header.php.

Please see the code below:

<li >  <a href="<?php the_permalink('/aboutus.html'); ?>"> AboutUs</a> </li>

As you can see Iam using the_permalink function to call the html file , but when I click in the navbar the aboutus nothing happen , I dont get the aboutus.html.

Can you please tell me how to ge to my point?

CodePudding user response:

You do not output anything from PHP. Change <?php to <?=:

<li >  <a href="<?= the_permalink('/aboutus.html'); ?>"> AboutUs</a> </li>

CodePudding user response:

Check the manual for that command: https://developer.wordpress.org/reference/functions/the_permalink/

If you call that function without any parameter it will output url of current page. If you want to specify some other page you have to pass that page id or WP_Post object type. You tried to pass some string containing page url, which is not supported, I would say.

CodePudding user response:

<li >  <a href="<?php echo $location_of_file .'/aboutus.html'; ?>"> AboutUs</a> </li>

$location_of_file will contain address to aboutus.html file without slash at the end.

  • Related