Hi MC,
Never used them but I hear these plugins are similar to Drupals types and views:
https://www.ads-software.com/plugins/types/
https://wp-types.com/home/views-create-elegant-displays-for-your-content/
Without the plugins create a post type ‘tidecharts’. Set the publish date the same as the chart date when publishing a tide chart post.
https://codex.www.ads-software.com/Post_Types
This in your theme’s functions.php file creates the post type and changes the query for the charts archive to show the posts in the current and next two months ordered from current to future charts.
With this you don’t need to remove old charts anymore because it will update the archive automatically.
// Register Custom Post Type
function custom_post_type() {
$labels = array(
'name' => _x( 'Tide Charts', 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( 'Tide Chart', 'Post Type Singular Name', 'text_domain' ),
'menu_name' => __( 'Tide Charts', 'text_domain' ),
'name_admin_bar' => __( 'Tide Charts', 'text_domain' ),
'parent_item_colon' => __( 'Parent Item:', 'text_domain' ),
'all_items' => __( 'All Charts', 'text_domain' ),
'add_new_item' => __( 'Add New Chart', 'text_domain' ),
'add_new' => __( 'Add New', 'text_domain' ),
'new_item' => __( 'New Chart', 'text_domain' ),
'edit_item' => __( 'Edit Chart', 'text_domain' ),
'update_item' => __( 'Update Chart', 'text_domain' ),
'view_item' => __( 'View Chart', 'text_domain' ),
'search_items' => __( 'Search Chart', 'text_domain' ),
'not_found' => __( 'Chart Not found', 'text_domain' ),
'not_found_in_trash' => __( 'Chart Not found in Trash', 'text_domain' ),
);
$args = array(
'label' => __( 'Tide_chart', 'text_domain' ),
'description' => __( 'Tide Chart', 'text_domain' ),
'labels' => $labels,
'supports' => array( ),
'taxonomies' => array( ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
);
register_post_type( 'tidecharts', $args );
}
// Hook into the 'init' action
add_action( 'init', 'custom_post_type', 0 );
function tidecharts_queries( $query ) {
// not an admin page and is the main query
if ( !is_admin() && $query->is_main_query() ) {
// query for the post type 'tidecharts' archive
if ( is_post_type_archive( 'tidecharts' ) ) {
// show three charts per page on this archive
$query->set( 'posts_per_page', 3 );
// published and future dates
$query->set( 'post_status', array( 'publish', 'future' ) );
$query->set( 'order', 'ASC' );
// query for posts from this month and later
$date_query = array(
'after' => array(
'year' => date( 'Y' ),
'month' => date( 'm' ),
'day' => 01,
),
'inclusive' => true,
);
$query->set( 'date_query', $date_query );
}
}
}
add_action( 'pre_get_posts', 'tidecharts_queries' );
btw:
consider creating a child theme instead of editing your theme directly – if you upgrade the theme all your modifications will be lost. Or create a plugin with the code above.