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() {
|
function get_footer_urls() {
|
||||||
$links = json_decode(get_setting("footerlinks", false), true);
|
$links = json_decode(get_setting("footerlinks", false), true);
|
||||||
if (is_array($links)) {
|
if (is_array($links)) {
|
||||||
return $links;
|
$filtered = [];
|
||||||
|
foreach ($links as $l) {
|
||||||
|
if ($l['title'] != "" && $l['link'] != "") {
|
||||||
|
$filtered[] = $l;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $filtered;
|
||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,20 @@
|
|||||||
<footer class="footer jumbotron mt-5 mb-0">
|
<footer class="footer jumbotron mt-5 mb-0">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-md-6">
|
<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>
|
||||||
<div class="col-12 col-md-6">
|
<div class="col-12 col-md-6">
|
||||||
<?php output_conditional("<h4>[[VAR]]</h4>", get_setting("businessname")); ?>
|
<?php output_conditional("<h4>[[VAR]]</h4>", get_setting("businessname")); ?>
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
<div id="footer-wrapper">
|
<div id="footer-wrapper">
|
||||||
<footer id="footer" class="container">
|
<footer id="footer" class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="6u 6u$(medium) 12u$(small)">
|
<div class="6u 12u$(medium) 12u$(small)">
|
||||||
|
|
||||||
<!-- Contact -->
|
<!-- Contact -->
|
||||||
<section class="widget contact">
|
<section class="widget contact">
|
||||||
<?php output_conditional("<h3>[[VAR]]</h3>", get_setting("businessname")); ?>
|
<?php output_conditional("<h3>[[VAR]]</h3>", get_setting("businessname")); ?>
|
||||||
<p>
|
<p>
|
||||||
<?php output_conditional('<div style="display: flex;"><div style="margin-right: 10px;"><i class="fas fa-phone fa-fw"></i></div> <div style="font-size: 130%;"><a href="tel:[[VAR]]">' .get_setting("phone"). '</a></div></div>', preg_replace("/[^0-9+]/", "", get_setting("phone"))); ?>
|
<?php output_conditional('<div style="display: flex;"><div style="margin-right: 10px;"><i class="fas fa-phone fa-fw"></i></div> <div style="font-size: 130%;"><a href="tel:[[VAR]]">' . get_setting("phone") . '</a></div></div>', preg_replace("/[^0-9+]/", "", get_setting("phone"))); ?>
|
||||||
<?php output_conditional('<div style="display: flex;"><div style="margin-right: 10px;"><i class="fas fa-map fa-fw"></i></div> <div>[[VAR]]</div></div>', str_replace("\n", "<br />\n", get_setting("address"))); ?>
|
<?php output_conditional('<div style="display: flex;"><div style="margin-right: 10px;"><i class="fas fa-map fa-fw"></i></div> <div>[[VAR]]</div></div>', str_replace("\n", "<br />\n", get_setting("address"))); ?>
|
||||||
<?php output_conditional('<div style="display: flex;"><div style="margin-right: 10px;"><i class="fas fa-envelope fa-fw"></i></div> <div>[[VAR]]</div></div>', get_setting("email")); ?>
|
<?php output_conditional('<div style="display: flex;"><div style="margin-right: 10px;"><i class="fas fa-envelope fa-fw"></i></div> <div>[[VAR]]</div></div>', get_setting("email")); ?>
|
||||||
</p>
|
</p>
|
||||||
@ -29,34 +29,58 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
</div>
|
</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)">
|
<div class="3u 6u(medium) 12u$(small)">
|
||||||
|
|
||||||
<!-- Links -->
|
<!-- Links -->
|
||||||
<!--<section class="widget links">
|
<section class="widget links">
|
||||||
<h3>Random Stuff</h3>
|
<h3>Links</h3>
|
||||||
<ul class="style2">
|
<ul class="style2">
|
||||||
<li><a href="#">Etiam feugiat condimentum</a></li>
|
<?php
|
||||||
<li><a href="#">Aliquam imperdiet suscipit odio</a></li>
|
foreach ($links1 as $l) {
|
||||||
<li><a href="#">Sed porttitor cras in erat nec</a></li>
|
?>
|
||||||
<li><a href="#">Felis varius pellentesque potenti</a></li>
|
<li>
|
||||||
<li><a href="#">Nullam scelerisque blandit leo</a></li>
|
<a href="<?php echo $l['link']; ?>">
|
||||||
|
<?php echo $l['title']; ?>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
</section>-->
|
</section>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="3u 6u$(medium) 12u$(small)">
|
<div class="3u 6u$(medium) 12u$(small)">
|
||||||
|
|
||||||
<!-- Links -->
|
<!-- Links -->
|
||||||
<!--<section class="widget links">
|
<section class="widget links">
|
||||||
<h3>Random Stuff</h3>
|
<h3> </h3>
|
||||||
<ul class="style2">
|
<ul class="style2">
|
||||||
<li><a href="#">Etiam feugiat condimentum</a></li>
|
<?php
|
||||||
<li><a href="#">Aliquam imperdiet suscipit odio</a></li>
|
foreach ($links2 as $l) {
|
||||||
<li><a href="#">Sed porttitor cras in erat nec</a></li>
|
?>
|
||||||
<li><a href="#">Felis varius pellentesque potenti</a></li>
|
<li>
|
||||||
<li><a href="#">Nullam scelerisque blandit leo</a></li>
|
<a href="<?php echo $l['link']; ?>">
|
||||||
|
<?php echo $l['title']; ?>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
</section>-->
|
</section>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user