1. Go to this page and download the library: Download helsingborg-stad/modularity library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
helsingborg-stad / modularity example snippets
/*
* Plugin Name: Modularity Article Module
* Plugin URI: -
* Description: Article module for Modularity
* Version: 1.0
* Author: Modularity
*/
namespace MyArticleModule;
class Article extends \Modularity\Module
{
public function __construct()
{
$id = 'article';
$nameSingular = 'Article';
$namePlural = 'Articles';
$description = 'Outputs a full article with title and content';
$supports = array('editor'); // All modules automatically supports title
$icon = '[BASE-64 encoded svg data-uri]';
$plugin = '/path/to/
add_action('Modularity', function () {
// Do your thing
});
add_action('Modularity/Module/mod-article/enqueue', function () {
// Do your thing
});
add_action('Modularity/Options/Module', function () {
echo '<input type="text">';
});
add_action('Modularity/save_block', function ($block, $post) {
// Your code here
});
add_filter('Modularity/Display/Markup', function ($markup, $module) {
return $markup;
});
add_filter('Modularity/Display/Markup', function ($markup, $module) {
return $markup;
});
add_filter('Modularity/CoreTemplatesSearchTemplates', function ($templates) {
$templates[] = 'my-custom-template';
return $templates;
});
add_filter('Modularity/Module/Posts/Date', function ($date, $postId, $postType) {
return $date;
});
add_filter('Modularity/Module/Posts/Slider/Arguments', function ($args) {
return $args;
});
add_filter('Modularity/Editor/ModuleCssScope',function($scopes) {
return array(
'mod-posts' => array(
's-buy-card' => __("Make this module sparkle!", 'modularity'),
's-user-list' => __("A boring user list is what i see", 'modularity')
)
);
});