Plugin Example

In this example, we are going to show how easy it is to create a theme for your SocialApparatus installation

The CSS for our theme will come from the Yeti® theme from BootSwatch®

The first thing you'll want to do is visit http://www.bootswatch.com, and download their Yeti® theme. You'll see a screen full of CSS code. Copy that code, and save it to your desktop as "theme.css".

We are going to name our theme "Yeti", after the bootswatch theme we are copying.

Create a folder inside your plugins folder called "yeti". Inside that folder, you'll need to create two files:

Now you'll want to start adding code to these files. Start with the "YetiPlugin.php" file. It should look like this:

<?php

namespace SocialApparatus;

class YetiPlugin {
    function __construct() {

    }
}

Notice that the name of the class is the same as the file.

Next, add the following text to your manifest.json file.

{
    "name"=>"yeti",
    "label"=>"Yeti Theme"
}
Notice the "name" field is the same as the folder name.

The next thing you'll want to do is make a place for our CSS file to live. Create a folder underneath your plugin folder called "assets". Inside that folder, create another one called "css". Put your "yeti.css" file there.

Now update your "YetiPlugin.php" file to load the CSS file.

<?php

namespace SocialApparatus;

class YetiPlugin {
    function __construct() {
        new CSS("yeti",getSitePath() . "plugins/yeti/assets/yeti.css",20000);
        removeCSS("bootstrap");
    }
}
The new CSS line tells the system to load the css file into the site header. the getSitePath() function tells the system where to find the css file, and the number 20000 tells the system the weight to give to the CSS. The higher the weight, the later the CSS is loaded.
The removeCSS line removes the default Twitter Bootstrap® cSS from the header.

Now go to your admin panel, and enable your theme plugin. Drag it to the bottom of the plugin list so it loads last.

That's it! That's how easy it is to create with SocialApparatus! Next you'll want to read our full documentation to get an idea of how all of our functions and classes work together!

Have a question or need a custom quote?

We're always available for new work. Click the button below and complete the contact form, and we'll get back with you within 24 hours.

Contact Us
Copyright © 2017 SocialApparatus