pkj/pkj-page-source

Wordpress plugin that lets you show custom post-types as rows or blocks in the content, to avoid manual duplication of content.

Installs: 31

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:wordpress-plugin

0.0.2 2014-08-02 22:36 UTC

This package is auto-updated.

Last update: 2024-02-29 02:37:48 UTC


README

Wordpress plugin that lets you add a source to page, to list custom post-types (forexample a list of the "service" content type below the main content on your /services "page").

Installation

Install with composer. Add this to your composer file:

"require": {
    "pkj/pkj-page-source": "dev-master"
}

Hooks

Changing the generated grid class definitions.

By default this plugin uses boostrap 3 column classes, (col-sm-X, col-md-X, col-lg-X), you can change this by adding this code in your functions.php file:

    add_filter('pkj-page-source_blocksizemap', 'my_theme_blocksizemap_hook');
    // Customize this function for your needs:
    public function my_theme_blocksizemap_hook ($blocksizemap) {
        $class = '';
        foreach($blocksizemap as $context => $perRow) {
            $bit = '';
            switch($context) {
                case 'l': $bit = 'lg'; break;
                case 'm': $bit = 'md'; break;
                case 's': $bit = 'sm'; break;
            }
            $gridSize = 12 / $perRow;
            $class .= "col-$bit-$gridSize ";
        }
        return $class;
    }

Changing the "row" class to theme specific.

    add_filter('pkj-page-source_rowclass', function () {
        return 'row'; // Change to your class.
    });