Plugin Directory

Changeset 3470773


Ignore:
Timestamp:
02/27/2026 12:19:22 AM (10 days ago)
Author:
manovermachine
Message:

Release 1.3.20: Add category selection for Special Posts, fix date range formatting across months, fix checkbox save issues

Location:
weather-write/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • weather-write/trunk/includes/class-admin.php

    r3455666 r3470773  
    47564756    $post_data = [
    47574757        'name' => isset( $_POST['name'] ) ? sanitize_text_field( $_POST['name'] ) : '',
    4758         'enabled' => ! empty( $_POST['enabled'] ),
     4758        'enabled' => isset( $_POST['enabled'] ) && filter_var( $_POST['enabled'], FILTER_VALIDATE_BOOLEAN ),
    47594759        'day' => isset( $_POST['day'] ) ? (int) $_POST['day'] : 5,
    47604760        'time' => isset( $_POST['time'] ) ? sanitize_text_field( $_POST['time'] ) : '17:00',
     
    47644764        'title_prompt' => isset( $_POST['title_prompt'] ) ? wp_kses_post( $_POST['title_prompt'] ) : '',
    47654765        'custom_prompt' => isset( $_POST['custom_prompt'] ) ? wp_kses_post( $_POST['custom_prompt'] ) : '',
    4766         'include_events' => ! empty( $_POST['include_events'] ),
     4766        'include_events' => isset( $_POST['include_events'] ) && filter_var( $_POST['include_events'], FILTER_VALIDATE_BOOLEAN ),
    47674767        'post_status' => isset( $_POST['post_status'] ) ? sanitize_text_field( $_POST['post_status'] ) : 'publish',
     4768        'category' => isset( $_POST['category'] ) ? (int) $_POST['category'] : 0,
    47684769        'tags' => isset( $_POST['tags'] ) && is_array( $_POST['tags'] ) ? array_map( 'sanitize_text_field', $_POST['tags'] ) : [],
    47694770        'featured_image_url' => isset( $_POST['featured_image_url'] ) ? esc_url_raw( $_POST['featured_image_url'] ) : '',
  • weather-write/trunk/includes/class-scheduler.php

    r3469811 r3470773  
    475475            $start_date = new DateTime( '+' . $start_offset . ' days', wp_timezone() );
    476476            $end_date = new DateTime( '+' . ( $start_offset + $special_forecast_days - 1 ) . ' days', wp_timezone() );
    477             $date_range = $start_date->format( 'M j' ) . '-' . $end_date->format( 'j' );
     477            // Show both month names if the range crosses months
     478            if ( $start_date->format( 'm' ) !== $end_date->format( 'm' ) ) {
     479                $date_range = $start_date->format( 'M j' ) . ' - ' . $end_date->format( 'M j' );
     480            } else {
     481                $date_range = $start_date->format( 'M j' ) . '-' . $end_date->format( 'j' );
     482            }
    478483           
    479484            $location = '';
     
    745750        $cat_id = ( isset( $options['default_category'] ) && (int)$options['default_category'] > 0 ) ? (int) $options['default_category'] : 0;
    746751
    747         // Override status and tags for special posts if configured
     752        // Override status, category, and tags for special posts if configured
    748753        if ( $special_post ) {
    749754            if ( isset( $special_post['post_status'] ) && $special_post['post_status'] !== '' ) {
    750755                $status = $special_post['post_status'];
     756            }
     757            if ( isset( $special_post['category'] ) && (int) $special_post['category'] > 0 ) {
     758                $cat_id = (int) $special_post['category'];
    751759            }
    752760            if ( isset( $special_post['tags'] ) && is_array( $special_post['tags'] ) && ! empty( $special_post['tags'] ) ) {
  • weather-write/trunk/includes/special-posts-admin.php

    r3455666 r3470773  
    266266                    <tr>
    267267                        <th scope="row">
     268                            <label for="wwrt-sp-category"><?php esc_html_e( 'Category', 'weather-write' ); ?></label>
     269                        </th>
     270                        <td>
     271                            <?php
     272                            $categories = get_categories( [ 'hide_empty' => false ] );
     273                            ?>
     274                            <select id="wwrt-sp-category" class="regular-text">
     275                                <option value="0"><?php esc_html_e( 'Use Default Category', 'weather-write' ); ?></option>
     276                                <?php foreach ( $categories as $cat ) : ?>
     277                                    <option value="<?php echo esc_attr( $cat->term_id ); ?>"><?php echo esc_html( $cat->name ); ?></option>
     278                                <?php endforeach; ?>
     279                            </select>
     280                            <p class="description"><?php esc_html_e( 'Select a category for this special post. If not set, the default category from Settings will be used.', 'weather-write' ); ?></p>
     281                        </td>
     282                    </tr>
     283                    <tr>
     284                        <th scope="row">
    268285                            <label for="wwrt-sp-tags"><?php esc_html_e( 'Tags', 'weather-write' ); ?></label>
    269286                        </th>
     
    410427            $('#wwrt-sp-include-events').prop('checked', true);
    411428            $('#wwrt-sp-post-status').val('publish');
     429            $('#wwrt-sp-category').val('0');
    412430            $('#wwrt-sp-tags').val('');
    413431            $('#wwrt-sp-featured-image').val('');
     
    427445            $('#wwrt-sp-include-events').prop('checked', preset.include_events !== false);
    428446            $('#wwrt-sp-post-status').val(preset.post_status || 'publish');
     447            $('#wwrt-sp-category').val(preset.category || '0');
    429448            $('#wwrt-sp-tags').val((preset.tags || []).join(', '));
    430449            $('#wwrt-sp-featured-image').val(preset.featured_image_url || '');
     
    454473                    $('#wwrt-sp-include-events').prop('checked', post.include_events !== false);
    455474                    $('#wwrt-sp-post-status').val(post.post_status || 'publish');
     475                    $('#wwrt-sp-category').val(post.category || '0');
    456476                    $('#wwrt-sp-tags').val((post.tags || []).join(', '));
    457477                    $('#wwrt-sp-featured-image').val(post.featured_image_url || '');
     
    483503                include_events: $('#wwrt-sp-include-events').is(':checked'),
    484504                post_status: $('#wwrt-sp-post-status').val(),
     505                category: parseInt($('#wwrt-sp-category').val()),
    485506                tags: tags
    486507            };
  • weather-write/trunk/readme.txt

    r3469811 r3470773  
    44Requires at least: 6.5
    55Tested up to: 6.8
    6 Stable tag: 1.3.19
     6Stable tag: 1.3.20
    77License: GPLv2 or later
    88License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    8787
    8888== Changelog ==
     89
     90= 1.3.20 =
     91- Added: Category selection for Special Posts - each special post can now be assigned to a unique category
     92- Fixed: Special Post date ranges now properly display both month names when crossing month boundaries (e.g., "Feb 27 - Mar 3" instead of "Feb 27-3")
     93- Fixed: Enabled checkbox in Special Posts modal now properly saves disabled state
     94- Fixed: Include Events checkbox in Special Posts modal now properly saves disabled state
    8995
    9096= 1.3.19 =
  • weather-write/trunk/weather-write.php

    r3469811 r3470773  
    33 * Plugin Name: Weather Write
    44 * Description: Generate and publish weather-aware posts with summaries, charts, images, alerts, SEO, and more — fully automated or on-demand.
    5  * Version: 1.3.19
     5 * Version: 1.3.20
    66 * Author: Mike Freeman - WeatherWrite
    77 * Plugin URI: https://www.weatherwrite.com/
Note: See TracChangeset for help on using the changeset viewer.