Introduction

By default, the column widgets display posts from the category or all categories in chronological order. For some reason you may want to have the latest post skipped (it is featured in the slider, etc) which can be done with a modification of the widget templates.

The Solution

This is considered a modification, and is provided as-is. We expect you understand what you are doing if applying coding changes using these or other WordPress tutorials. Make a backup of your existing file so you can replace it if something goes wrong and you need to start over. Modified files WILL probably be replaced by a theme update at some point, so keep note of your changes for future reference or see our guides below. We cannot assist you with modifying your theme or support problems you encounter as a result!

If you are modifying a theme as part of a client project, the following are really important!

How to Modify Your Theme the Right Way
How to Track Update Changes and Maintain Modifications

On a local copy of the theme, open ocmx/widgets and you will see the dual-column-widget.php and four-column-widget.php. Around line 45 is the query:

//Set the post Aguments and Query accordingly
        $count = 0;
        $numposts = 0;
        $ocmx_posts = new WP_Query( $cat_id."posts_per_page=".$post_count."&post_type=$posttype" );

You must insert an offset argument at the end of the string, after $posttype:

 

$ocmx_posts = new WP_Query( $cat_id."posts_per_page=".$post_count."&post_type=$posttype&offset=1" );

 

This should skip the first post in the query results. Save the files and upload to wp-content/themes/knead/ocmx/widgets via FTP.

Elementor