Add footer link support to themes, stop get_footer_urls() from returning empty links (#15)
This commit is contained in:
parent
51e4a8336a
commit
52c25153e3
@ -486,12 +486,18 @@ function get_fontawesome_css($echo = true) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array [[title, url], [title, url]] of links for the page footer
|
||||
* Return an array [[title, link], [title, link]] of links for the page footer
|
||||
*/
|
||||
function get_footer_urls() {
|
||||
$links = json_decode(get_setting("footerlinks", false), true);
|
||||
if (is_array($links)) {
|
||||
return $links;
|
||||
$filtered = [];
|
||||
foreach ($links as $l) {
|
||||
if ($l['title'] != "" && $l['link'] != "") {
|
||||
$filtered[] = $l;
|
||||
}
|
||||
}
|
||||
return $filtered;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
@ -9,6 +9,20 @@
|
||||
<footer class="footer jumbotron mt-5 mb-0">
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-6">
|
||||
<ul class="list-unstyled ml-4">
|
||||
<?php
|
||||
$links = get_footer_urls();
|
||||
foreach ($links as $l) {
|
||||
?>
|
||||
<li>
|
||||
<a href="<?php echo $l['link']; ?>">
|
||||
<i class="fas fa-arrow-right"></i> <?php echo $l['title']; ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<?php output_conditional("<h4>[[VAR]]</h4>", get_setting("businessname")); ?>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<div id="footer-wrapper">
|
||||
<footer id="footer" class="container">
|
||||
<div class="row">
|
||||
<div class="6u 6u$(medium) 12u$(small)">
|
||||
<div class="6u 12u$(medium) 12u$(small)">
|
||||
|
||||
<!-- Contact -->
|
||||
<section class="widget contact">
|
||||
@ -29,34 +29,58 @@
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
$links = get_footer_urls();
|
||||
$links1 = [];
|
||||
$links2 = [];
|
||||
foreach ($links as $l) {
|
||||
if (count($links1) < 5) {
|
||||
$links1[] = $l;
|
||||
} else {
|
||||
$links2[] = $l;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="3u 6u(medium) 12u$(small)">
|
||||
|
||||
<!-- Links -->
|
||||
<!--<section class="widget links">
|
||||
<h3>Random Stuff</h3>
|
||||
<section class="widget links">
|
||||
<h3>Links</h3>
|
||||
<ul class="style2">
|
||||
<li><a href="#">Etiam feugiat condimentum</a></li>
|
||||
<li><a href="#">Aliquam imperdiet suscipit odio</a></li>
|
||||
<li><a href="#">Sed porttitor cras in erat nec</a></li>
|
||||
<li><a href="#">Felis varius pellentesque potenti</a></li>
|
||||
<li><a href="#">Nullam scelerisque blandit leo</a></li>
|
||||
<?php
|
||||
foreach ($links1 as $l) {
|
||||
?>
|
||||
<li>
|
||||
<a href="<?php echo $l['link']; ?>">
|
||||
<?php echo $l['title']; ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</section>-->
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="3u 6u$(medium) 12u$(small)">
|
||||
|
||||
<!-- Links -->
|
||||
<!--<section class="widget links">
|
||||
<h3>Random Stuff</h3>
|
||||
<section class="widget links">
|
||||
<h3> </h3>
|
||||
<ul class="style2">
|
||||
<li><a href="#">Etiam feugiat condimentum</a></li>
|
||||
<li><a href="#">Aliquam imperdiet suscipit odio</a></li>
|
||||
<li><a href="#">Sed porttitor cras in erat nec</a></li>
|
||||
<li><a href="#">Felis varius pellentesque potenti</a></li>
|
||||
<li><a href="#">Nullam scelerisque blandit leo</a></li>
|
||||
<?php
|
||||
foreach ($links2 as $l) {
|
||||
?>
|
||||
<li>
|
||||
<a href="<?php echo $l['link']; ?>">
|
||||
<?php echo $l['title']; ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</section>-->
|
||||
</section>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user