Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSimon Zupan
Courses Plus Student 183 PointsHi! How can I create the same footer text to appear at the bottom of each blog post? Thank you!
I wonder how can I create the same footer text to appear at the bottom of each blog post?
1 Answer
Sam Donald
36,305 PointsIf it's the same for everywhere on the site (i.e. all pages including a static front-page if you use one, and posts).
Create a
footer.php
file.-
Your sites closing
</body>
and
</html>
tags should be in this file.
-
Above/before your closing
</body>
tag write your footer code.
Example...
<footer>
<div id="footer-wrapper">
<ul id="footer-contact">
<h3>Contact Us</h3>
<li>1300 123 456</li>
<li>example@footer.mail</li>
<li>47 Example For Footer SA 3542</li>
</ul>
<ul id="footer-legal">
<h3>Disclaimer</h3>
<li>This footer has been made as an example for a Treehouse question. It is meant for demonstration puposes only</li>
<li>Released under Creative Commons</li>
</ul>
</div>
</footer>
<?php wp_footer(); ?>
</body>
</html>
-
You'll notice that line immediately after the closing
</footer>
tag, wrapped in a php block. That's an important piece of code. It tells Wordpress where to place important files including scripts etc...
-
Place the code
<?php get_footer() ?>
at the very bottom of any page you want
footer.php
to appear (i.e. index.php, front-page.php etc...)
Note: You can obviously construct this footer.php
page with php code, but this is just a simple example for what to do if you want exactly the same thing everywhere.
Joel Brennan
18,300 PointsJoel Brennan
18,300 PointsHi,
There are 3 different methods explained here: https://ithemes.com/2011/03/20/automatically-add-content-to-your-wordpress-posts-and-pages/
Is that the sort of thing you are looking for?
I guess you may also be able to 'hardcode' it into your template inside the loop if you wanted to display it on a certain template only.