WordPress-Use the get_footer() function to load and display footer content
In WordPress theme development, the get_footer() function is a template tag used to load and display the footer section. The footer usually contains the website’s copyright information, bottom navigation links, additional script references, etc. The get_footer() function allows these contents to be consistent across multiple pages and simplifies the theme development process.
Parameters
get_footer( $name = null )
$name (optional): Specifies the name of the footer template file to load. If not specified, the footer.php file in the theme directory is loaded by default.
Use scenario
The get_footer() function is usually used in the main template files of WordPress themes such as index.php, archive.php, single.php, search.php, etc. to insert footer content at the bottom of the page. By calling get_footer(), WordPress will automatically load and display the correct footer template file.
Example code
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset=”<?php bloginfo( ‘charset’ ); ?>”>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php get_header(); ?> <!– Load and display header content –>
<!– Body content –>
<?php get_footer(); ?> <!– Load and display footer content –>
</body>
</html>
In the above example, the get_footer() function is placed before the </body> tag of the HTML document to load and display the footer content.
Custom footer
Similar to the get_header() function introduced earlier, we can also create custom footer template files for different pages or layouts. For example, we can create a file called footer-custom.php and write custom footer content in it. Then, load this custom footer template file by specifying the $name parameter as ‘custom’ in the get_footer() function.
Search
Popular on Blogar
Content Marketing-What is Content Marketing
- October 24th, 2023
- 1414 Views
Social Media Marketing-Social Media Marketing (SMM)
- October 24th, 2023
- 1702 Views
Pay-Per-Click-What is PPC
- October 24th, 2023
- 1277 Views
WordPress sticky articles in categories but not on the homepage
- August 13th, 2024
- 99 Views
WordPress-How to show single post content in front-end?
- August 26th, 2024
- 97 Views
WordPress display articles by category
- August 28th, 2024
- 91 Views
How To Find The IP Of Any Whatsapp Call
- September 3rd, 2024
- 90 Views
WordPress-How to create a Taxonomy?
- August 28th, 2024
- 87 Views
WordPress next post / previous post on the same category
- November 11th, 2024
- 84 Views
Social Media Marketing – 53 Resources For First Time Entrepreneurs
- October 24th, 2023
- 807 Views
Recent Post
Content Marketing-What is Content Marketing
- October 24th, 2023
- 1414 Views
Social Media Marketing-Social Media Marketing (SMM)
- October 24th, 2023
- 1702 Views
Pay-Per-Click-What is PPC
- October 24th, 2023
- 1277 Views
VMware cannot install VMware Tools, prompts VMCI, memory driver
- November 25th, 2024
- 64 Views
More Post
- Howo Tractor Truck
- Howo Tipper/Dump Truck
- Howo Cargo Truck
- Howo Concrete Mixer Truck
- Howo Special Truck
- Howo Light Truck
- Shacman Tractor Truck
- Shacman Tipper/Dump Truck
- Shacman Cargo Truck
- Shacman Concrete Mixer Truck
- LGMG Mining Trucks
- XCMG Wheel Loader
- XCMG Excavator
- XCMG Crane
- XCMG Asphalt Pavers
- XCMG Road Roller
- Shantui Bulldozer
Copyright © 2024 BBBBF All Rights Reserved.