I'm a WordPress beginner. I would like to simply display links to the pages in my website as list items in the footer. The WordPress get_pages() doesn't seem to work. Here is a part of my footer.php code:
?php
/**
* The template for displaying the footer.
*
* Contains the closing of the #content div and all content after
*
* @package understrap
*/
$the_theme = wp_get_theme();
$container = get_theme_mod( 'understrap_container_type' );
$all_pages = get_pages();
?>
<?php get_template_part( 'sidebar-templates/sidebar', 'footerfull' ); ?>
<div class="wrapper" id="wrapper-footer">
<footer>
<div class="<?php echo esc_attr( $container ); ?>" id="main-footer">
<nav class="row">
<ul class="col-sm-3">
<li><strong>name of website</strong></li>
<?php foreach ($all_pages as $page):?>
<?php $title = $page->title;?>
<?php $link = $page->url;?>
<li> <a href="<?php echo $link?>"><?php echo $title?> </a></li>
Am I using the get_pages() function wrong?
Aucun commentaire:
Enregistrer un commentaire