# ultimate-post/2.6.2/classes/options/Blocks.php

Post Grid Gutenberg Blocks – PostX, version 2.6.2. 227 lines.

- Page: https://pluginprobe.com/plugins/ultimate-post/2.6.2/code/classes/options/Blocks.php
- Raw: https://pluginprobe.com/plugins/ultimate-post/2.6.2/raw/classes/options/Blocks.php
- Modified: 2022-06-28T07:44:06+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/ultimate-post/2.6.2/code/classes/options/Blocks.php#L10-L20`.

```php
<?php
namespace ULTP;

defined('ABSPATH') || exit;

class Option_Blocks{
    public function __construct() {
        $this->create_admin_page();
    }

    public static function get_blocks_settings() {
        $arr = array(
            'grid' => array(
                'label' => __('Post Grid Blocks', 'ultimate-post'),
                'attr' => array(
                    'post_grid_1' => array(
                        'label' => __('Post Grid #1', 'ultimate-post'),
                        'default' => true,
                        'live' => 'https://ultp.wpxpo.com/post-grid-1/',
                        'docs' => 'https://docs.wpxpo.com/docs/postx/',
                        'icon' => ULTP_URL.'assets/img/blocks/post-grid-1.svg'
                    ),
                    'post_grid_2' => array(
                        'label' => __('Post Grid #2', 'ultimate-post'),
                        'default' => true,
                        'live' => 'https://ultp.wpxpo.com/post-grid-2/',
                        'docs' => 'https://docs.wpxpo.com/docs/postx/',
                        'icon' => ULTP_URL.'assets/img/blocks/post-grid-2.svg'
                    ),
                    'post_grid_3' => array(
                        'label' => __('Post Grid #3', 'ultimate-post'),
                        'default' => true,
                        'live' => 'https://ultp.wpxpo.com/post-grid-3/',
                        'docs' => 'https://docs.wpxpo.com/docs/postx/',
                        'icon' => ULTP_URL.'assets/img/blocks/post-grid-3.svg'
                    ),
                    'post_grid_4' => array(
                        'label' => __('Post Grid #4', 'ultimate-post'),
                        'default' => true,
                        'live' => 'https://ultp.wpxpo.com/post-grid-4/',
                        'docs' => 'https://docs.wpxpo.com/docs/postx/',
                        'icon' => ULTP_URL.'assets/img/blocks/post-grid-4.svg'
                    ),
                    'post_grid_5' => array(
                        'label' => __('Post Grid #5', 'ultimate-post'),
                        'default' => true,
                        'live' => 'https://ultp.wpxpo.com/post-grid-5/',
                        'docs' => 'https://docs.wpxpo.com/docs/postx/',
                        'icon' => ULTP_URL.'assets/img/blocks/post-grid-5.svg'
                    ),
                    'post_grid_6' => array(
                        'label' => __('Post Grid #6', 'ultimate-post'),
                        'default' => true,
                        'live' => 'https://ultp.wpxpo.com/post-grid-6/',
                        'docs' => 'https://docs.wpxpo.com/docs/postx/',
                        'icon' => ULTP_URL.'assets/img/blocks/post-grid-6.svg'
                    ),
                    'post_grid_7' => array(
                        'label' => __('Post Grid #7', 'ultimate-post'),
                        'default' => true,
                        'live' => 'https://ultp.wpxpo.com/post-grid-7/',
                        'docs' => 'https://docs.wpxpo.com/docs/postx/',
                        'icon' => ULTP_URL.'assets/img/blocks/post-grid-7.svg'
                    )
                )
            ),
            'list' => array(
                'label' => __('Post List Blocks', 'ultimate-post'),
                'attr' => array(
                    'post_list_1' => array(
                        'label' => __('Post List #1', 'ultimate-post'),
                        'default' => true,
                        'live' => 'https://ultp.wpxpo.com/post-list-1/',
                        'docs' => 'https://docs.wpxpo.com/docs/postx/',
                        'icon' => ULTP_URL.'assets/img/blocks/post-list-1.svg'
                    ),
                    'post_list_2' => array(
                        'label' => __('Post List #2', 'ultimate-post'),
                        'default' => true,
                        'live' => 'https://ultp.wpxpo.com/post-list-2/',
                        'docs' => 'https://docs.wpxpo.com/docs/postx/',
                        'icon' => ULTP_URL.'assets/img/blocks/post-list-2.svg'
                    ),
                    'post_list_3' => array(
                        'label' => __('Post List #3', 'ultimate-post'),
                        'default' => true,
                        'live' => 'https://ultp.wpxpo.com/post-list-3/',
                        'docs' => 'https://docs.wpxpo.com/docs/postx/',
                        'icon' => ULTP_URL.'assets/img/blocks/post-list-3.svg'
                    ),
                    'post_list_4' => array(
                        'label' => __('Post List #4', 'ultimate-post'),
                        'default' => true,
                        'live' => 'https://ultp.wpxpo.com/post-list-4/',
                        'docs' => 'https://docs.wpxpo.com/docs/postx/',
                        'icon' => ULTP_URL.'assets/img/blocks/post-list-4.svg'
                    ),
                    
                )
                ),
            'slider' => array(
                'label' => __('Post Slider', 'ultimate-post'),
                'attr' => array(
                    'post_slider_1' => array(
                        'label' => __('Post Slider #1', 'ultimate-post'),
                        'default' => true,
                        'live' => 'https://ultp.wpxpo.com/post-slide-1/',
                        'docs' => 'https://docs.wpxpo.com/docs/postx/',
                        'icon' => ULTP_URL.'/assets/img/blocks/post-slider-1.svg'
                    )
                )
            ),
            'other' => array(
                'label' => __('Others Post Blocks', 'ultimate-post'),
                'attr' => array(
                    'post_module_1' => array(
                        'label' => __('Post Module #1', 'ultimate-post'),
                        'default' => true,
                        'live' => 'https://ultp.wpxpo.com/post-module-1/',
                        'docs' => 'https://docs.wpxpo.com/docs/postx/',
                        'icon' => ULTP_URL.'/assets/img/blocks/post-module-1.svg'
                    ),
                    'post_module_2' => array(
                        'label' => __('Post Module #2', 'ultimate-post'),
                        'default' => true,
                        'live' => 'https://ultp.wpxpo.com/post-module-2/',
                        'docs' => 'https://docs.wpxpo.com/docs/postx/',
                        'icon' => ULTP_URL.'/assets/img/blocks/post-module-2.svg'
                    ),
                    'heading' => array(
                        'label' => __('Heading', 'ultimate-post'),
                        'default' => true,
                        'live' => 'https://ultp.wpxpo.com/heading/',
                        'docs' => 'https://docs.wpxpo.com/docs/postx/',
                        'icon' => ULTP_URL.'/assets/img/blocks/heading.svg'
                    ),
                    'image' => array(
                        'label' => __('Image', 'ultimate-post'),
                        'default' => true,
                        'live' => 'https://ultp.wpxpo.com/image/',
                        'docs' => 'https://docs.wpxpo.com/docs/postx/all-blocks/image-blocks/',
                        'icon' => ULTP_URL.'/assets/img/blocks/image.svg'
                    ),
                    'taxonomy' => array(
                        'label' => __('Taxonomy', 'ultimate-post'),
                        'default' => true,
                        'live' => 'https://ultp.wpxpo.com/taxonomy/',
                        'docs' => 'https://docs.wpxpo.com/docs/postx/all-blocks/taxonomy-style-1/',
                        'icon' => ULTP_URL.'/assets/img/blocks/taxonomy.svg'
                    ),
                    'wrapper' => array(
                        'label' => __('Wrapper', 'ultimate-post'),
                        'default' => true,
                        'live' => 'https://ultp.wpxpo.com/wrapper/',
                        'docs' => 'https://docs.wpxpo.com/docs/postx/add-on/wrapper-blocks/',
                        'icon' => ULTP_URL.'/assets/img/blocks/wrapper.svg'
                    ),
                    'archive_title' => array(
                        'label' => __('Archive Title', 'ultimate-post'),
                        'default' => true,
                        'icon' => ULTP_URL.'/assets/img/blocks/archive-title.svg'
                    ),
                    'news_ticker' => array(
                        'label' => __('News Ticker', 'ultimate-post'),
                        'default' => true,
                        'live' => 'https://ultp.wpxpo.com/news-ticker/',
                        'docs' => 'https://docs.wpxpo.com/docs/postx/all-blocks/news-ticker-block/',
                        'icon' => ULTP_URL.'/assets/img/blocks/news-ticker.svg'
                    ),
                )
            )
        );

        return $arr;
    }
  

    public static function create_admin_page() { ?>
        <div class="ultp-dashboard-container ultp-block-option">
            
            <div class="ultp-dashboard-body is-blank">
                <?php
                $option_data = ultimate_post()->get_setting();
                $blocks_settings = self::get_blocks_settings();

                foreach ($blocks_settings as $blocks) { ?>
                    <h4 class="ultp-mid-title"><?php echo esc_html($blocks['label']); ?></h4>
                    <div class="ultp-block-grid-content">
                        <?php foreach ($blocks['attr'] as $key => $val) { ?>
                                <div class="ultp-block-control">
                                    <div class="ultp-control-meta">
                                        <img src="<?php echo esc_url($val['icon']); ?>" alt="overview content">
                                        <div><?php echo esc_html($val['label']); ?></div>
                                    </div>
                                    <div class="ultp-control-option">
                                        <?php 
                                        if (isset($val['docs'])) { ?>
                                            <a href="<?php echo esc_url($val['docs']); ?>"  target="_blank" class="ultp-option-tooltip">
                                                <span><?php esc_html_e('Documentation', 'ultimate-post'); ?></span>
                                                <div class="dashicons dashicons-book"></div>
                                            </a>
                                        <?php } ?>
                                        <?php 
                                        if (isset($val['live'])) { ?>
                                            <a href="<?php echo esc_url($val['live']); ?>" target="_blank" class="ultp-option-tooltip">
                                                <span><?php esc_html_e('Live View', 'ultimate-post'); ?></span>
                                                <div class="dashicons dashicons-visibility"></div>
                                            </a>
                                        <?php } ?>
                                        <?php
                                            $output = $val['default'] ? 'checked' : '';
                                            if (isset($option_data[$key])) {
                                                $output = $option_data[$key] == 'yes' ? 'checked' : '';
                                            }
                                        ?>
                                        <input type="checkbox" data-type="blocks" class="ultp-addons-enable" id="<?php echo esc_attr($key); ?>" <?php echo esc_attr($output); ?>/><label for="<?php echo esc_attr($key); ?>">Toggle</label>
                                    </div>
                                </div>
                        <?php } ?>
                    </div>
                <?php } ?>
                    
            </div>
        </div>
        <?php
    }
}
```
