Crocoblock / suggestions

The suggestions for CrocoBlock project
194 stars 78 forks source link

Offset and posts number on archive Listing Grid (Jet Engine) #670

Open OneTap-Online opened 4 years ago

OneTap-Online commented 4 years ago

Hi,

I wanted to use offset and posts number when turning on "Use As Archive Template" in the Listing Grid widget, so we can make more flexible blog layouts. Example: https://zzpservicedesk.onetap.website/category/belastingen/page/2

I changed the code locally to support this, can this be merged with the project?

Edits I did: File: jet-engine/includes/components/elementor-views/static-widgets/grid.php Line 113: remove condition from posts_num

Line 118, insert:

            $this->add_control(
                'posts_offset',
                array(
                    'label'       => __( 'Posts offset', 'jet-engine' ),
                    'type'        => Controls_Manager::NUMBER,
                    'default'     => 0,
                    'min'         => 0,
                    'max'         => 1000,
                    'step'        => 1,
                    'condition'   => array(
                        'is_archive_template' => 'yes',
                    ),
                )
            );

Line 2103:

                if($settings['posts_num'] !== 0) {
                    return array_slice($wp_query->posts, $settings['posts_offset'], $settings['posts_num']);
                } else {
                    return $wp_query->posts;
                }

Entire file can be found for download here: https://filetransfer.kpn.com/download/df655f56-a8d6-4e9d-9ac9-dfdd661cebed#oeUrNsX_2mapBcMpOYtQ3Vr8PTdCjRAMDDeNJq4ch6A. (password is crocoblock)

Thanks in advance!

OneTap-Online commented 4 years ago

Hi,

Any updates on this issue?