Plugin Directory

Changeset 2529462


Ignore:
Timestamp:
05/11/2021 03:18:52 AM (5 years ago)
Author:
jweathe
Message:

Resolved framing issue, enhanced widget options, improved documentation.

Location:
also-in-this-series/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • also-in-this-series/trunk/plugin-core.php

    r2528564 r2529462  
    2121    $fargs = wp_parse_args( $args, [
    2222        'series-slug' => null,
    23         'seriesSlug' => null, // legacy arg
     23        'seriesSlug' => null, // legacy param
    2424        'use-frame' => true,
    2525        'frame-width' => false,
    2626        'sort-order' => false,
    27         'order' => false, // legacy var
     27        'order' => false, // legacy param
    2828    ] );
    2929
     
    4848    $framewidth = $fargs['framewidth'];
    4949    $sortorder = $fargs['sortorder'];
    50     $framing = $post && $useframe && $framewidth;
    5150
    5251    if( $seriesslug ) {
     
    7877    $postsinseries = get_posts( $query );
    7978
     79    $framing = $post && $useframe && $framewidth;
    8080    if( $framing ) {
    8181        $pivot = 0;
  • also-in-this-series/trunk/plugin-widgets.php

    r2528557 r2529462  
    66
    77class SeriesWidget extends WP_Widget {
    8 
    98    function __construct() {
    109        parent::__construct(
     
    1615
    1716    public function widget( $widget, $fields ) {
    18         $fields = wp_parse_args( $fields, [
     17        $ffields = wp_parse_args( $fields, [
    1918            'series-slug' => false,
    2019            'series-use-frame' => false,
     20            'series-frame-width' => false,
     21            'series-sort-order' => false,
    2122        ] );
    2223
    23         $seriesslug = apply_filters( 'alsointhisseries_widget_seriesslug', $fields['series-slug'] );
    24         $useframe = apply_filters( 'alsointhisseries_widget_useframe', $fields['series-use-frame'] );
     24        $ffields = apply_filters( 'alsointhisseries_widget_fields', $ffields, $widget );
     25
     26        $seriesslug = $ffields['series-slug'];
     27        $useframe = $ffields['series-use-frame'];
     28        $framewidth = $ffields['series-frame-width'];
     29        $sortorder = $ffields['series-sort-order'];
    2530
    2631        ob_start();
    27         displaySeries( [ 'series-slug' => $seriesslug, 'use-frame' => $useframe ] );
     32        displaySeries( [
     33            'series-slug' => $seriesslug,
     34            'use-frame' => $useframe,
     35            'frame-width' => $framewidth,
     36            'sort-order' => $sortorder,
     37        ] );
    2838        $serieslisting = ob_get_contents();
    2939        ob_end_clean();
     
    3646            'series-slug' => false,
    3747            'series-use-frame' => false,
     48            'series-frame-width' => false,
     49            'series-sort-order' => false,
    3850        ] );
    3951
    4052        $seriesslug = $ffields['series-slug'];
    4153        $useframe = $ffields['series-use-frame'];
     54        $framewidth = $ffields['series-frame-width'];
     55        $sortorder = $ffields['series-sort-order'];
    4256
    4357        $series = get_terms( SERIES_TAXONOMY );
     
    5064        $fields['series-slug'] = isset( $new_fields['series-slug'] ) ? strip_tags( $new_fields['series-slug'] ) : false;
    5165        $fields['series-use-frame'] = isset( $new_fields['series-use-frame'] ) ? strip_tags( $new_fields['series-use-frame'] ) : false;
     66        $fields['series-frame-width'] = isset( $new_fields['series-frame-width'] ) ? strip_tags( $new_fields['series-frame-width'] ) : false;
     67        $fields['series-sort-order'] = isset( $new_fields['series-sort-order'] ) ? strip_tags( $new_fields['series-sort-order'] ) : false;
    5268
    5369        return $fields;
    5470    }
    55 
    5671}
    5772
  • also-in-this-series/trunk/plugin.php

    r2528564 r2529462  
    44Plugin URI: https://planetjon.ca/projects/also-in-this-series/
    55Description: Group related posts in a series with a custom Series taxonomy. and a list of all posts in the series in your content.
    6 Version: 1.7.2
     6Version: 1.7.3
    77Requires at least: 3.5.0
    88Requires PHP: 5.4
  • also-in-this-series/trunk/readme.txt

    r2528564 r2529462  
    66Requires PHP: 5.4
    77Tested up to: 5.7.1
    8 Stable tag: 1.7.2
     8Stable tag: 1.7.3
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1111
    12 Group related posts in a series with a custom Series taxonomy. and a list of all posts in the series in your content.
     12Group related posts in a post series and automatically list all of the posts in the series as part of the content.
    1313
    1414== Description ==
    1515
    16 Group related posts in a series with a custom Series taxonomy. Automatically insert a list of all posts in the series in your content,
    17 or use the [alsointhisseries] shortcode to manually insert as needed. To manually insert an arbitraty series, use the series parameter in the shortcode
    18 [alsointhisseries series-slug="your-series-slug"]
     16Group related posts in a series. Automatically insert a list of all posts in the series as part of the content.
     17Manually embed a series listing with the provided shortcode and widget. Override the series template with a custom template.
     18
     19A great [rundown of the plugin](https://planetjon.ca/4823/making-a-blog-series-with-also-in-this-series "How to use Also In This Series") is available on the Planetjon blog.
     20
     21=== Shortcode ===
     22
     23To manually insert the series listing of a post within a series as part of the content, use the shortcode [alsointhisseries].
     24This will have no effect if the post isn't ikn a series.
     25
     26To manually insert a specific series, use the series-slug attribute with the shortcode like [alsointhisseries series-slug="your-series-slug"].
     27
     28
     29The shortcode attributes are
     30
     31* series-slug="slug"
     32* use-frame="yes|no"
     33* frame-width="number"
     34* sort-order="asc|desc"
     35
     36=== Widget ===
     37
     38A widget that exposes all of the above options is available.
    1939
    2040=== Custom Template ===
     
    3757== Changelog ==
    3858
     59= 1.7.3 =
     60* Resolved issue with series framing.
     61* Exposed more options to the widget interface.
     62
    3963= 1.7.1 =
    4064* Significant updates to the codebase to facilitate future updates.
  • also-in-this-series/trunk/views/admin/settings.php

    r2528557 r2529462  
    11<div class="wrap">
    22    <div id="icon-themes" class="icon32"></div>
    3     <h2>Also In This Series Settings</h2>
     3    <h2><?php _e( 'Also In This Series Settings', 'also-in-this-series' ) ?></h2>
    44    <?php //settings_errors() ?>
    55    <form method="post" action="options.php">
  • also-in-this-series/trunk/views/admin/widget-form.php

    r2528557 r2529462  
    11<div class="also-in-this-series-widget-form">
    22    <p>
     3        <label><?php _e( 'Select series', 'also-in-this-series' ) ?></label>
    34        <select id="<?php echo $this->get_field_id( 'series-slug' ) ?>" name="<?php echo $this->get_field_name( 'series-slug' ) ?>">
    4             <option><?php _e( 'Use Current Post Series', 'also-in-this-series' ) ?></option>
     5            <option value=""><?php _e( 'Use Current Post Series', 'also-in-this-series' ) ?></option>
    56            <optgroup label="<?php _e( 'Available Series', 'also-in-this-series' ) ?>">
    67            <?php foreach( $series as $s ) : ?>
     
    1112    </p>
    1213    <p>
    13         <label>Use frame?
    14             <input
    15                 type="checkbox"
    16                 id="<?php echo $this->get_field_id( 'series-use-frame' ) ?>"
    17                 name="<?php echo $this->get_field_name( 'series-use-frame' ) ?>"
    18                 value="yes"
    19                 <?php checked( $useframe, 'yes' ) ?> />
    20         </label>
     14        <label><?php _e( 'Window series listing?', 'also-in-this-series' ) ?></label>
     15        <select id="<?php echo $this->get_field_id( 'series-use-frame' ) ?>" name="<?php echo $this->get_field_name( 'series-use-frame' ) ?>">
     16            <option value=""><?php _e( 'Default', 'also-in-this-series' ) ?></option>
     17            <option value="yes" <?php selected( $useframe, 'yes' ) ?>><?php _e( 'Yes', 'also-in-this-series' ) ?></option>
     18            <option value="no" <?php selected( $useframe, 'no' ) ?>><?php _e( 'No', 'also-in-this-series' ) ?></option>
     19        </select>
     20    </p>
     21    <p>
     22        <label><?php _e( 'Set window size', 'also-in-this-series' ) ?></label>
     23        <input
     24            type="number"
     25            id="<?php echo $this->get_field_id( 'series-frame-width' ) ?>"
     26            name="<?php echo $this->get_field_name( 'series-frame-width' ) ?>"
     27            value="<?php echo esc_attr( $framewidth ) ?>"
     28            placeholder="Leave blank for default setting"
     29        />
     30    </p>
     31    <p>
     32        <label><?php _e( 'Series listing order', 'also-in-this-series' ) ?></label>
     33        <select id="<?php echo $this->get_field_id( 'series-sort-order' ) ?>" name="<?php echo $this->get_field_name( 'series-sort-order' ) ?>">
     34            <option value=""><?php _e( 'Default', 'also-in-this-series' ) ?></option>
     35            <option value="asc" <?php selected( $sortorder, 'asc' ) ?>><?php _e( 'Oldest to newest', 'also-in-this-series' ) ?></option>
     36            <option value="desc" <?php selected( $sortorder, 'desc' ) ?>><?php _e( 'Newest to oldest', 'also-in-this-series' ) ?></option>
     37        </select>
    2138    </p>
    2239</div>
Note: See TracChangeset for help on using the changeset viewer.