Page 1 of 1

Link from sidebar to footer

Posted: Wed Mar 13, 2019 7:29 pm
by Artem
Hi, everyone!
I need to move links from sidebar to footer.
Two blocks. Useful Links and Categories in Two Block Footer

+++++++++++Footer+++++++++++++++
Links Categories
Link1 Music
Link2 Video
... ...
Linkn Else

Re: Link from sidebar to footer

Posted: Wed Mar 13, 2019 8:11 pm
by Edi
You can modify any theme to meet your requirements and use code of the plugins in the footer template.

Re: Link from sidebar to footer

Posted: Wed Mar 13, 2019 10:01 pm
by Artem
I understood how to add categories:

Code: Select all

<?php foreach ($categories->db as $key=>$fields): ?>
<a href="<?php echo DOMAIN_CATEGORIES.$key; ?>"><?php echo $fields['name']; ?></a>
<?php endforeach ?>
but I still can't add useful links

Re: Link from sidebar to footer

Posted: Thu Mar 14, 2019 12:37 pm
by Artem
For Categories:

Code: Select all

<ul class="list-unstyled">	
	<?php $items = getCategories(); ?>
	<?php foreach ($items as $category): ?> 
		<li><a href="<?php echo $category->permalink(); ?>"><?php echo $category->name(); ?></a></li>
	<?php endforeach ?>
</ul>
How can I do this for the "Links"?

Re: Link from sidebar to footer

Posted: Thu Mar 14, 2019 12:57 pm
by Edi
Why not use the code of the plugin Links? ;-)

Re: Link from sidebar to footer

Posted: Thu Mar 14, 2019 1:19 pm
by Artem
I do not understand how. Could you set an example?

Re: Link from sidebar to footer

Posted: Fri Mar 15, 2019 12:31 am
by Edi
There is a description in the documentation:

https://docs.bludit.com/en/dev-snippets/plugins

Sorry for not posting the link before.

Re: Link from sidebar to footer

Posted: Fri Mar 15, 2019 8:36 am
by Artem
Thank you! Perfect!
Maybe someone will be useful:

Code: Select all

<footer>
	<!-- Categories (plugin Categories must be activated) -->
	<h5 class="text-uppercase font-weight-normal"><?php echo getPlugin('pluginCategories')->getValue('label'); ?></h5>
	<ul>	
		<?php foreach (getCategories() as $category): ?> 
			<li><a href="<?php echo $category->permalink(); ?>"><?php echo $category->name(); ?></a></li>
			<!-- Each category is an Category-Object -->
			<!--
			<li>Category name: <?php //echo $category->name(); ?></li>
			<li>Category key: <?php //echo $category->key(); ?></li>
			<li>Category description: <?php //echo $category->description(); ?></li>
			<li>Category template: <?php //echo $category->template(); ?></li>
			<li>Category link: <?php //echo $category->permalink(); ?></li>
			<li>Category number of pages: <?php //echo count($category->pages()); ?></li>
			-->	
		<?php endforeach ?>
	</ul>
	
	<!-- Useful Links (plugin Links must be activated) -->
	<h5><?php echo getPlugin('pluginLinks')->getValue('label'); ?></h5>
	<?php
		$jsondb = getPlugin('pluginLinks')->getValue('jsondb', false);
		$links = json_decode($jsondb);
	?>
	<ul>
		<?php foreach( $links as $name=>$url ): ?>
			<li><a href="<?php echo $url; ?>"><?php echo $name; ?></a></li>
		<?php endforeach ?>
	</ul>
</footer>