ok. i want create a php file. i want make header.php footer.php. i need it because it will make me not tried to edit one by one in html. how to do that.? thank in advance answer soon ! :v
footer{ text-align:center; margin-top: 150px;}
ul{list-style-type: none;}
a {text-decoration: none; color: green;}
li a,li {padding: 0px 10px;}
<!---Header--->
<ul class="navbar">
<li><a href="#">navbar</a>
<a href="#">navbar</a>
<a href="#">navbar</a>
<a href="#">navbar</a>
<a href="#">navbar</a></li>
</ul>
<!----footer--->
<footer class="w3-container w3-green">
<p>lorem ipsum lorem ipsum lorem ipsum lorem ipsum</p>
</footer>
Just create the file header.php and use the get_header() function to include it in your index.php. To include your footer.php you can use the get_footer() function.
header.php
footer.php
index.php
use php’s include_once.
First, put your header and footer contents in a header.php and footer.php file.
Header.php
Footer.php
Then in your main php files, let’s say it’s index.php, you can do it this way.
Create header.html and footer.html:
header.html:
footer.html:
Whenever you want to include either of the two code in a portion of your code, paste the following:
For the header:
For the footer:
Whenever you want to edit the style of your header/footer, just go into those files and create the styles you wish. Alternatively you can link a css file to the files.