[Solved] How to determine if a plugin is enabled?
-
- Ssr. Bludit
- Posts: 23
- Joined: Mon May 22, 2017 10:15 pm
Hi,
I'd like to add an RSS link in the footer of the theme I'm working on. However, this link will only make sense if the RSS plugin is enabled. How can I check to see if a given plugin is enabled? The contents of $plugins["all"]["pluginRSS"] doesn't seem to provide the enabled status of the plugin.
Thanks,
Jon
I'd like to add an RSS link in the footer of the theme I'm working on. However, this link will only make sense if the RSS plugin is enabled. How can I check to see if a given plugin is enabled? The contents of $plugins["all"]["pluginRSS"] doesn't seem to provide the enabled status of the plugin.
Thanks,
Jon
-
- Ssr. Bludit
- Posts: 23
- Joined: Mon May 22, 2017 10:15 pm
- Edi
- Site Admin
- Posts: 3121
- Joined: Sun Aug 09, 2015 5:01 pm
- Location: Zurich
- Has thanked: 54 times
- Been thanked: 77 times
- Contact:
If a plugin is enabled or not is shown on the plugin page.
You can use a plugin in your theme always by adding a hook. The plugin RSS Feed uses the hook siteHead. Therefore there ha`s to be the helper Theme::plugins('siteHead') in the header section of the theme. Something like this:
To show the RSS icon you can use something like this:
An example for this gives the theme Log.
You can use a plugin in your theme always by adding a hook. The plugin RSS Feed uses the hook siteHead. Therefore there ha`s to be the helper Theme::plugins('siteHead') in the header section of the theme. Something like this:
Code: Select all
<head>
...
<?php
Theme::plugins('siteHead');
?>
...
</head>
Code: Select all
if( $plugins['all']['pluginRSS']->installed() ) {
echo '<a href="'.DOMAIN_BASE.'rss.xml'.'" class="fa-rss"><span class="label">RSS</span></a>';
}
Last edited by Edi on Wed Jan 03, 2018 1:14 am, edited 1 time in total.
Reason: Correction of snippet to show RSS icon.
Reason: Correction of snippet to show RSS icon.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
-
- Ssr. Bludit
- Posts: 23
- Joined: Mon May 22, 2017 10:15 pm
Thanks. $plugins['all']['pluginRSS']->installed() is what I'm after.