PHP code example of pkj / pkj-page-source

1. Go to this page and download the library: Download pkj/pkj-page-source 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/ */

    

pkj / pkj-page-source example snippets



    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;
    }


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