Plugin Directory

Changeset 3439954


Ignore:
Timestamp:
01/15/2026 02:11:37 AM (5 weeks ago)
Author:
owthub
Message:

New Feature: "Advanced Shortcode Parameters" v1.5

Location:
inspirepulse-quotes/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • inspirepulse-quotes/trunk/admin/css/inspqu-admin.css

    r3436617 r3439954  
    704704/* Modal Box */
    705705.inspqu-modal-content {
    706     width: 520px;
     706    width: 720px;
    707707    background: #ffffff;
    708708    border-radius: 16px;
    709709    padding: 25px 30px;
    710     margin: 50px auto;
     710    margin: 2px auto;
    711711    box-shadow: 0 20px 40px rgba(0,0,0,0.18);
    712712    animation: slideDown 0.25s ease-out;
     
    724724    justify-content: space-between;
    725725    align-items: center;
    726     margin-bottom: 25px;
    727726}
    728727
     
    13141313.inspqu-preview-modal .inspqu-modal-body {
    13151314  flex:1;
    1316   padding:15px;
    13171315  overflow-y:auto;
    13181316  display:flex;
  • inspirepulse-quotes/trunk/admin/partials/inspqu-about.php

    r3428454 r3439954  
    5757                <p><?php esc_html_e('Create and download full quote database backup securely.', 'inspirepulse-quotes'); ?></p>
    5858            </div>
     59            <div class="inspqu-feature-card type-advanced">
     60                <div class="inspqu-icon-big">🎯</div>
     61                <h3><?php esc_html_e('Advanced Shortcode Parameters', 'inspirepulse-quotes'); ?></h3>
     62                <p><?php esc_html_e('Filter by category, author, limit results, order quotes, and exclude specific quotes using powerful shortcode parameters.', 'inspirepulse-quotes'); ?></p>
     63            </div>
    5964        </div>
    6065    </main>
  • inspirepulse-quotes/trunk/admin/partials/inspqu-shortcode.php

    r3428454 r3439954  
    2020                <h2><?php esc_html_e('Shortcodes List', 'inspirepulse-quotes'); ?></h2>
    2121                <div class="inspqu-header-btns">
     22                    <a href="javascript:void(0);" id="inspqu-open-shortcode-guide" class="inspqu-add-btn" title="<?php esc_attr_e('View Complete Shortcode Guide', 'inspirepulse-quotes'); ?>">
     23                        <span class="inspqu-add-icon">ℹ️</span> <?php esc_html_e('Shortcode Guide', 'inspirepulse-quotes'); ?>
     24                    </a>
    2225                    <a href="<?php echo esc_url( admin_url('admin.php?page=inspqu-settings' ) ); ?>" class="inspqu-add-btn inspqu-back-btn">
    2326                        <span class="inspqu-add-icon">⬅️</span> <?php esc_html_e('Back to Settings', 'inspirepulse-quotes'); ?>
     
    9699            </div>
    97100        </div>
     101
     102        <!-- Shortcode Guide Modal -->
     103        <div id="inspqu-shortcode-guide-modal" class="inspqu-modal">
     104            <div class="inspqu-modal-content" style="max-width: 1000px;">
     105                <div class="inspqu-modal-header">
     106                    <h2><?php esc_html_e('Complete Shortcode Guide', 'inspirepulse-quotes'); ?></h2>
     107                    <span class="inspqu-modal-close">&times;</span>
     108                </div>
     109                <div class="inspqu-modal-body" style="max-height: 50vh; overflow-y: auto;">
     110                    <div class="inspqu-shortcode-guide">
     111                        <h3><?php esc_html_e('1. Main Shortcode: [inspqu]', 'inspirepulse-quotes'); ?></h3>
     112                        <p><?php esc_html_e('Display rotating inspirational quotes with customizable options.', 'inspirepulse-quotes'); ?></p>
     113                       
     114                        <h4><?php esc_html_e('Available Attributes:', 'inspirepulse-quotes'); ?></h4>
     115                        <table class="inspqu-guide-table">
     116                            <thead>
     117                                <tr>
     118                                    <th><?php esc_html_e('Attribute', 'inspirepulse-quotes'); ?></th>
     119                                    <th><?php esc_html_e('Description', 'inspirepulse-quotes'); ?></th>
     120                                    <th><?php esc_html_e('Default', 'inspirepulse-quotes'); ?></th>
     121                                    <th><?php esc_html_e('Example', 'inspirepulse-quotes'); ?></th>
     122                                </tr>
     123                            </thead>
     124                            <tbody>
     125                                <tr>
     126                                    <td><code>design</code></td>
     127                                    <td><?php esc_html_e('Choose layout style: Elegant Dark, Gradient Glow Box, Paper Vintage Look, Floating Glass Overlay, Big Center Text + Corner', 'inspirepulse-quotes'); ?></td>
     128                                    <td>Elegant Dark</td>
     129                                    <td><code>design="Gradient Glow Box"</code></td>
     130                                </tr>
     131                                <tr>
     132                                    <td><code>timer</code></td>
     133                                    <td><?php esc_html_e('Auto-rotation interval in seconds', 'inspirepulse-quotes'); ?></td>
     134                                    <td><?php esc_html_e('Global setting', 'inspirepulse-quotes'); ?></td>
     135                                    <td><code>timer="10"</code></td>
     136                                </tr>
     137                                <tr>
     138                                    <td><code>category</code></td>
     139                                    <td><?php esc_html_e('Filter by category name or ID (comma-separated for multiple)', 'inspirepulse-quotes'); ?></td>
     140                                    <td><?php esc_html_e('All categories', 'inspirepulse-quotes'); ?></td>
     141                                    <td><code>category="Motivation"</code> or <code>category="1,2"</code></td>
     142                                </tr>
     143                                <tr>
     144                                    <td><code>author</code></td>
     145                                    <td><?php esc_html_e('Filter by author name (comma-separated for multiple)', 'inspirepulse-quotes'); ?></td>
     146                                    <td><?php esc_html_e('All authors', 'inspirepulse-quotes'); ?></td>
     147                                    <td><code>author="Einstein"</code> or <code>author="Einstein,Steve Jobs"</code></td>
     148                                </tr>
     149                                <tr>
     150                                    <td><code>limit</code></td>
     151                                    <td><?php esc_html_e('Maximum number of quotes to display', 'inspirepulse-quotes'); ?></td>
     152                                    <td><?php esc_html_e('All available', 'inspirepulse-quotes'); ?></td>
     153                                    <td><code>limit="5"</code></td>
     154                                </tr>
     155                                <tr>
     156                                    <td><code>orderby</code></td>
     157                                    <td><?php esc_html_e('Sort order: random, date, author, id', 'inspirepulse-quotes'); ?></td>
     158                                    <td>random</td>
     159                                    <td><code>orderby="date"</code></td>
     160                                </tr>
     161                                <tr>
     162                                    <td><code>order</code></td>
     163                                    <td><?php esc_html_e('Sort direction: ASC or DESC (only when orderby is not random)', 'inspirepulse-quotes'); ?></td>
     164                                    <td>ASC</td>
     165                                    <td><code>order="DESC"</code></td>
     166                                </tr>
     167                                <tr>
     168                                    <td><code>id</code></td>
     169                                    <td><?php esc_html_e('Display a specific quote by ID', 'inspirepulse-quotes'); ?></td>
     170                                    <td><?php esc_html_e('All quotes', 'inspirepulse-quotes'); ?></td>
     171                                    <td><code>id="42"</code></td>
     172                                </tr>
     173                                <tr>
     174                                    <td><code>exclude</code></td>
     175                                    <td><?php esc_html_e('Exclude specific quote IDs (comma-separated)', 'inspirepulse-quotes'); ?></td>
     176                                    <td><?php esc_html_e('None', 'inspirepulse-quotes'); ?></td>
     177                                    <td><code>exclude="1,2,3"</code></td>
     178                                </tr>
     179                                <tr>
     180                                    <td><code>status</code></td>
     181                                    <td><?php esc_html_e('Filter by status: active, draft, or all', 'inspirepulse-quotes'); ?></td>
     182                                    <td>active</td>
     183                                    <td><code>status="all"</code></td>
     184                                </tr>
     185                            </tbody>
     186                        </table>
     187
     188                        <h4><?php esc_html_e('Usage Examples:', 'inspirepulse-quotes'); ?></h4>
     189                        <div class="inspqu-examples">
     190                            <p><code>[inspqu]</code> - <?php esc_html_e('Default layout with global timer', 'inspirepulse-quotes'); ?></p>
     191                            <p><code>[inspqu design="Gradient Glow Box"]</code> - <?php esc_html_e('Specific design with global timer', 'inspirepulse-quotes'); ?></p>
     192                            <p><code>[inspqu timer="10"]</code> - <?php esc_html_e('Default design with 10-second rotation', 'inspirepulse-quotes'); ?></p>
     193                            <p><code>[inspqu design="Paper Vintage Look" timer="8"]</code> - <?php esc_html_e('Custom design and timer', 'inspirepulse-quotes'); ?></p>
     194                            <p><code>[inspqu category="Motivation" limit="5"]</code> - <?php esc_html_e('5 quotes from Motivation category', 'inspirepulse-quotes'); ?></p>
     195                            <p><code>[inspqu author="Einstein" timer="15"]</code> - <?php esc_html_e('Quotes by Einstein with 15-second rotation', 'inspirepulse-quotes'); ?></p>
     196                            <p><code>[inspqu category="Success" orderby="date" order="DESC"]</code> - <?php esc_html_e('Latest Success quotes', 'inspirepulse-quotes'); ?></p>
     197                            <p><code>[inspqu id="42"]</code> - <?php esc_html_e('Display specific quote #42', 'inspirepulse-quotes'); ?></p>
     198                            <p><code>[inspqu category="Motivation,Success" limit="10"]</code> - <?php esc_html_e('Combined filters with sharing', 'inspirepulse-quotes'); ?></p>
     199                        </div>
     200                    </div>
     201                </div>
     202                <div class="inspqu-modal-actions">
     203                    <button type="button" class="inspqu-modal-btn inspqu-modal-close"><?php esc_html_e('Close', 'inspirepulse-quotes'); ?></button>
     204                </div>
     205            </div>
     206        </div>
    98207    </main>
    99208    <?php INSPQU_Layout::inspqu_get_footer(); ?>
    100209</div>
     210
     211<style>
     212.inspqu-shortcode-guide {
     213    font-size: 14px;
     214    line-height: 1.6;
     215}
     216
     217.inspqu-shortcode-guide h3 {
     218    color: #0073aa;
     219    margin-top: 25px;
     220    margin-bottom: 15px;
     221    font-size: 18px;
     222}
     223
     224.inspqu-shortcode-guide h4 {
     225    color: #333;
     226    margin-top: 20px;
     227    margin-bottom: 10px;
     228    font-size: 16px;
     229}
     230
     231.inspqu-guide-table {
     232    width: 100%;
     233    border-collapse: collapse;
     234    margin: 15px 0;
     235    background: #fff;
     236}
     237
     238.inspqu-guide-table thead {
     239    background: #f5f5f5;
     240}
     241
     242.inspqu-guide-table th,
     243.inspqu-guide-table td {
     244    padding: 12px;
     245    text-align: left;
     246    border: 1px solid #ddd;
     247}
     248
     249.inspqu-guide-table th {
     250    font-weight: 600;
     251    color: #333;
     252}
     253
     254.inspqu-guide-table code {
     255    background: #f0f0f0;
     256    padding: 2px 6px;
     257    border-radius: 3px;
     258    font-size: 13px;
     259    color: #c7254e;
     260}
     261
     262.inspqu-examples {
     263    background: #f9f9f9;
     264    padding: 15px;
     265    border-left: 4px solid #0073aa;
     266    margin: 15px 0;
     267}
     268
     269.inspqu-examples p {
     270    margin: 8px 0;
     271}
     272
     273.inspqu-examples code {
     274    background: #fff;
     275    padding: 4px 8px;
     276    border-radius: 3px;
     277    font-size: 13px;
     278    color: #c7254e;
     279    display: inline-block;
     280    margin-right: 10px;
     281}
     282</style>
     283
     284<script>
     285jQuery(document).ready(function($) {
     286    $('#inspqu-open-shortcode-guide').on('click', function() {
     287        $('#inspqu-shortcode-guide-modal').fadeIn(300);
     288    });
     289
     290    $(document).on('click', '#inspqu-shortcode-guide-modal .inspqu-modal-close, #inspqu-shortcode-guide-modal', function(e) {
     291        if (e.target === this) {
     292            $('#inspqu-shortcode-guide-modal').fadeOut(300);
     293        }
     294    });
     295});
     296</script>
  • inspirepulse-quotes/trunk/includes/class-inspqu-query.php

    r3428454 r3439954  
    1414class INSPQU_Query_Helper {
    1515
    16     public static function inspqu_get_data( $table_key, $where = [], $order_by = '' ) {
     16    public static function inspqu_get_data( $table_key, $where = [], $order_by = '', $limit = 0, $exclude_ids = [] ) {
    1717
    1818        global $wpdb;
     
    5555        }
    5656
     57        // Exclude specific IDs
     58        if ( ! empty( $exclude_ids ) && is_array( $exclude_ids ) ) {
     59            $exclude_ids = array_map( 'absint', $exclude_ids );
     60            $exclude_ids = array_filter( $exclude_ids );
     61            if ( ! empty( $exclude_ids ) ) {
     62                $exclude_placeholders = implode( ',', array_fill( 0, count( $exclude_ids ), '%d' ) );
     63                $exclude_condition = $wpdb->prepare( "id NOT IN ({$exclude_placeholders})", $exclude_ids );
     64                if ( strpos( $sql, 'WHERE' ) !== false ) {
     65                    $sql .= ' AND ' . $exclude_condition;
     66                } else {
     67                    $sql .= ' WHERE ' . $exclude_condition;
     68                }
     69            }
     70        }
     71
    5772        if ( 'RAND()' === $order_by ) {
    5873
     
    6479                'id ASC'          => 'id ASC',
    6580                'id DESC'         => 'id DESC',
     81                'date ASC'        => 'created_at ASC',
     82                'date DESC'       => 'created_at DESC',
     83                'author ASC'      => 'quote_author ASC',
     84                'author DESC'     => 'quote_author DESC',
    6685            ];
    6786
     
    7190        }
    7291
     92        // Add limit
     93        if ( $limit > 0 ) {
     94            $limit = absint( $limit );
     95            $sql .= $wpdb->prepare( ' LIMIT %d', $limit );
     96        }
     97
    7398        return $wpdb->get_results( $sql, ARRAY_A );
     99    }
     100
     101    /**
     102     * Get quotes with category and author filtering
     103     *
     104     * @param array $args Query arguments
     105     * @return array Quotes with category information
     106     */
     107    public static function inspqu_get_quotes_with_filters( $args = [] ) {
     108        global $wpdb;
     109
     110        $defaults = [
     111            'category'    => '',
     112            'author'       => '',
     113            'limit'        => 0,
     114            'orderby'      => 'random',
     115            'order'        => 'ASC',
     116            'id'           => 0,
     117            'exclude'      => [],
     118            'status'       => 1,
     119        ];
     120
     121        $args = wp_parse_args( $args, $defaults );
     122
     123        $quotes_table = esc_sql( INSPQU_App_Helper::inspqu_get_table_name_by_key( 'quotes' ) );
     124        $categories_table = esc_sql( INSPQU_App_Helper::inspqu_get_table_name_by_key( 'categories' ) );
     125        $rel_table = esc_sql( INSPQU_App_Helper::inspqu_get_table_name_by_key( 'quote_category_relation' ) );
     126
     127        // Build SQL query
     128        $sql = "SELECT q.*, c.name as category_name, c.id as category_id
     129                FROM {$quotes_table} q
     130                LEFT JOIN {$rel_table} r ON q.id = r.quote_id
     131                LEFT JOIN {$categories_table} c ON r.category_id = c.id
     132                WHERE 1=1";
     133
     134        $where_conditions = [];
     135        $where_values = [];
     136
     137        // Filter by specific quote ID
     138        if ( ! empty( $args['id'] ) ) {
     139            $where_conditions[] = "q.id = %d";
     140            $where_values[] = absint( $args['id'] );
     141        }
     142
     143        // Filter by category
     144        if ( ! empty( $args['category'] ) ) {
     145            $category_names = is_array( $args['category'] ) ? $args['category'] : explode( ',', $args['category'] );
     146            $category_names = array_map( 'trim', $category_names );
     147            $category_names = array_filter( $category_names );
     148           
     149            if ( ! empty( $category_names ) ) {
     150                // Check if any are numeric (category IDs)
     151                $category_ids = [];
     152                $category_name_list = [];
     153               
     154                foreach ( $category_names as $cat ) {
     155                    if ( is_numeric( $cat ) ) {
     156                        $category_ids[] = absint( $cat );
     157                    } else {
     158                        $category_name_list[] = $cat;
     159                    }
     160                }
     161               
     162                $cat_conditions = [];
     163                if ( ! empty( $category_ids ) ) {
     164                    $placeholders = implode( ',', array_fill( 0, count( $category_ids ), '%d' ) );
     165                    $cat_conditions[] = "c.id IN ({$placeholders})";
     166                    $where_values = array_merge( $where_values, $category_ids );
     167                }
     168               
     169                if ( ! empty( $category_name_list ) ) {
     170                    $placeholders = implode( ',', array_fill( 0, count( $category_name_list ), '%s' ) );
     171                    $cat_conditions[] = "c.name IN ({$placeholders})";
     172                    $where_values = array_merge( $where_values, $category_name_list );
     173                }
     174               
     175                if ( ! empty( $cat_conditions ) ) {
     176                    $where_conditions[] = '(' . implode( ' OR ', $cat_conditions ) . ')';
     177                }
     178            }
     179        }
     180
     181        // Filter by author
     182        if ( ! empty( $args['author'] ) ) {
     183            $authors = is_array( $args['author'] ) ? $args['author'] : explode( ',', $args['author'] );
     184            $authors = array_map( 'trim', $authors );
     185            $authors = array_filter( $authors );
     186           
     187            if ( ! empty( $authors ) ) {
     188                $placeholders = implode( ',', array_fill( 0, count( $authors ), '%s' ) );
     189                $where_conditions[] = "q.quote_author IN ({$placeholders})";
     190                $where_values = array_merge( $where_values, $authors );
     191            }
     192        }
     193
     194        // Filter by status
     195        if ( isset( $args['status'] ) && $args['status'] !== '' ) {
     196            if ( $args['status'] === 'all' ) {
     197                // Don't filter by status
     198            } else {
     199                $where_conditions[] = "q.status = %d";
     200                $where_values[] = absint( $args['status'] );
     201            }
     202        } else {
     203            // Default to active only
     204            $where_conditions[] = "q.status = %d";
     205            $where_values[] = 1;
     206        }
     207
     208        // Exclude specific quote IDs
     209        if ( ! empty( $args['exclude'] ) ) {
     210            $exclude_ids = is_array( $args['exclude'] ) ? $args['exclude'] : explode( ',', $args['exclude'] );
     211            $exclude_ids = array_map( 'absint', $exclude_ids );
     212            $exclude_ids = array_filter( $exclude_ids );
     213           
     214            if ( ! empty( $exclude_ids ) ) {
     215                $placeholders = implode( ',', array_fill( 0, count( $exclude_ids ), '%d' ) );
     216                $where_conditions[] = "q.id NOT IN ({$placeholders})";
     217                $where_values = array_merge( $where_values, $exclude_ids );
     218            }
     219        }
     220
     221        // Add WHERE conditions
     222        if ( ! empty( $where_conditions ) ) {
     223            $prepared_sql = $wpdb->prepare( implode( ' AND ', $where_conditions ), $where_values );
     224            $sql .= ' AND ' . str_replace( '%', '%%', $prepared_sql );
     225        }
     226
     227        // Order by
     228        if ( $args['orderby'] === 'random' ) {
     229            $sql .= ' ORDER BY RAND()';
     230        } else {
     231            $order_by_map = [
     232                'id'     => 'q.id',
     233                'date'   => 'q.created_at',
     234                'author' => 'q.quote_author',
     235            ];
     236           
     237            $order_column = isset( $order_by_map[ $args['orderby'] ] ) ? $order_by_map[ $args['orderby'] ] : 'q.id';
     238            $order_direction = strtoupper( $args['order'] ) === 'DESC' ? 'DESC' : 'ASC';
     239            $sql .= " ORDER BY {$order_column} {$order_direction}";
     240        }
     241
     242        // Limit
     243        if ( $args['limit'] > 0 ) {
     244            $limit = absint( $args['limit'] );
     245            $sql .= $wpdb->prepare( ' LIMIT %d', $limit );
     246        }
     247
     248        $results = $wpdb->get_results( $sql, ARRAY_A );
     249
     250        // Remove duplicates (quotes can have multiple categories)
     251        if ( ! empty( $results ) ) {
     252            $unique_quotes = [];
     253            $seen_ids = [];
     254           
     255            foreach ( $results as $quote ) {
     256                if ( ! in_array( $quote['id'], $seen_ids ) ) {
     257                    $unique_quotes[] = $quote;
     258                    $seen_ids[] = $quote['id'];
     259                }
     260            }
     261           
     262            return $unique_quotes;
     263        }
     264
     265        return $results;
    74266    }
    75267
  • inspirepulse-quotes/trunk/includes/inspqu-constants.php

    r3436670 r3439954  
    1717
    1818if ( ! defined( 'INSPQU_VERSION' ) ) {
    19     define( 'INSPQU_VERSION', '1.4' );
     19    define( 'INSPQU_VERSION', '1.5' );
    2020}
    2121
  • inspirepulse-quotes/trunk/inspirepulse-quotes.php

    r3436670 r3439954  
    44 * Plugin URI:        https://onlinewebtutorblog.com/inspirepulse-quotes/
    55 * Description:       Display stunning motivational quotes anywhere on your WordPress site using a simple shortcode. Includes auto-refresh, quote categories, author info, and an elegant built-in quote manager with powerful admin tools.
    6  * Version:           1.4
     6 * Version:           1.5
    77 * Author:            Online Web Tutor
    88 * Author URI:        https://onlinewebtutorblog.com/
  • inspirepulse-quotes/trunk/public/class-inspqu-public.php

    r3428454 r3439954  
    2929    public function inspqu_render_quote_template( $atts ) {
    3030
     31        // Parse shortcode attributes with defaults
    3132        $atts = shortcode_atts([
    32             'design' => 'default',
     33            'design'  => 'default',
     34            'timer'   => '',
     35            'category' => '',
     36            'author'  => '',
     37            'limit'   => 0,
     38            'orderby' => 'random',
     39            'order'   => 'ASC',
     40            'id'      => 0,
     41            'exclude' => '',
     42            'status'  => 'active',
    3343        ], $atts, 'inspqu');
    3444
    35         $design_key = strtolower( $atts['design'] );
     45        $design_key = strtolower( trim( $atts['design'] ) );
    3646
    37         if ( ! in_array( $design_key, INSPQU_App_Helper::inspqu_get_allowed_quote_templates_keys() ) ) {
     47        // Validate design
     48        if ( $design_key !== 'default' && ! in_array( $design_key, INSPQU_App_Helper::inspqu_get_allowed_quote_templates_keys() ) ) {
    3849            return '<p><i>-- No Design Found! --</i></p>';
    3950        }
    4051
    41         // Get quotes randomly
    42         $quotes = INSPQU_Query_Helper::inspqu_get_data( 'quotes', [], 'RAND()' );
    43         if ( ! $quotes ) {
     52        // Prepare query arguments
     53        $query_args = [
     54            'category' => ! empty( $atts['category'] ) ? $atts['category'] : '',
     55            'author'   => ! empty( $atts['author'] ) ? $atts['author'] : '',
     56            'limit'    => ! empty( $atts['limit'] ) ? absint( $atts['limit'] ) : 0,
     57            'orderby'  => ! empty( $atts['orderby'] ) ? strtolower( trim( $atts['orderby'] ) ) : 'random',
     58            'order'    => ! empty( $atts['order'] ) ? strtoupper( trim( $atts['order'] ) ) : 'ASC',
     59            'id'       => ! empty( $atts['id'] ) ? absint( $atts['id'] ) : 0,
     60            'exclude'  => ! empty( $atts['exclude'] ) ? $atts['exclude'] : '',
     61            'status'   => ! empty( $atts['status'] ) ? strtolower( trim( $atts['status'] ) ) : 'active',
     62        ];
     63
     64        // Convert status string to integer
     65        if ( $query_args['status'] === 'active' ) {
     66            $query_args['status'] = 1;
     67        } elseif ( $query_args['status'] === 'draft' ) {
     68            $query_args['status'] = 0;
     69        } elseif ( $query_args['status'] === 'all' ) {
     70            $query_args['status'] = 'all';
     71        } else {
     72            $query_args['status'] = 1; // Default to active
     73        }
     74
     75        // Get quotes with filters
     76        $quotes = INSPQU_Query_Helper::inspqu_get_quotes_with_filters( $query_args );
     77       
     78        if ( ! $quotes || empty( $quotes ) ) {
    4479            return '<p><i>-- No Quotes Found! --</i></p>';
    4580        }
     
    71106        );
    72107
    73         $timer_ms = intval( get_option('inspqu_timer_miliseconds') ) > 0
    74                     ? intval( get_option('inspqu_timer_miliseconds') )
    75                     : INSPQU_App_Helper::inspqu_get_default_timer_value();
     108        // Handle timer - check shortcode attribute first, then global setting
     109        $timer_ms = INSPQU_App_Helper::inspqu_get_default_timer_value();
     110       
     111        if ( ! empty( $atts['timer'] ) ) {
     112            // Timer from shortcode (in seconds)
     113            $timer_seconds = absint( $atts['timer'] );
     114            if ( $timer_seconds > 0 ) {
     115                $timer_ms = $timer_seconds * 1000;
     116            }
     117        } else {
     118            // Use global setting
     119            $global_timer = intval( get_option('inspqu_timer_miliseconds') );
     120            if ( $global_timer > 0 ) {
     121                $timer_ms = $global_timer;
     122            }
     123        }
    76124
    77125        $quote_template_object = str_replace("-", "_", $quote_template);
     
    80128            "inspqu_object_{$quote_template_object}",
    81129            array(
    82                 'timer_ms' => $timer_ms
     130                'timer_ms' => $timer_ms,
    83131            )
    84132        );
     
    89137        ob_start();
    90138        include $template_path;
    91         return ob_get_clean();
     139        $output = ob_get_clean();
     140
     141        return $output;
    92142    }
    93143}
  • inspirepulse-quotes/trunk/readme.txt

    r3436672 r3439954  
    55Requires PHP: 7.4
    66Tested up to: 6.9
    7 Stable tag: 1.4
    8 Version: 1.4
     7Stable tag: 1.5
     8Version: 1.5
    99Author: Online Web Tutor
    1010Author URI: https://onlinewebtutorblog.com/
     
    5353**⚙️ Advanced Features**
    5454* ⏱ **Flexible Timer Controls** - Set auto-refresh timing globally or per shortcode (in seconds)
     55* 🎯 **Advanced Shortcode Parameters** - Filter by category, author, limit results, order quotes, and more
    5556* 🔔 **Toastr Notifications** - Clean, modern admin alerts for all actions (success, error, warnings)
    5657* 💾 **SQL Data Backup** - Generate and download complete database backups with one click
     
    7273* `design` - Choose your preferred layout style (optional, default: "Elegant Dark")
    7374* `timer` - Set auto-rotation interval in seconds (optional, uses global setting if not specified)
     75* `category` - Filter by category name or ID (supports multiple: comma-separated)
     76* `author` - Filter quotes by author name (supports multiple: comma-separated)
     77* `limit` - Limit the number of quotes to display (optional, default: all available)
     78* `orderby` - Sort order: `random` (default), `date`, `author`, `id`
     79* `order` - Sort direction: `ASC` or `DESC` (only when orderby is not random)
     80* `id` - Display a specific quote by ID
     81* `exclude` - Exclude specific quote IDs (comma-separated)
     82* `status` - Filter by status: `active` (default), `draft`, or `all`
    7483
    7584**Available Design Options:**
     
    8089* `Big Center Text + Corner` - Bold, impactful centered text layout
    8190
    82 **Examples:**
     91**Basic Examples:**
    8392```
    8493[inspqu]                                    → Default layout, global timer
     
    8695[inspqu timer="10"]                         → Default design, 10-second rotation
    8796[inspqu design="Paper Vintage Look" timer="8"] → Custom design + timer
     97```
     98
     99**Advanced Filtering Examples:**
     100
     101**Filter by Category:**
     102```
     103[inspqu category="Motivation"]              → Show quotes from Motivation category
     104[inspqu category="Success"]                 → Show quotes from Success category
     105[inspqu category="Motivation,Success"]      → Show quotes from multiple categories
     106[inspqu category="1,2"]                     → Show quotes by category IDs
     107```
     108
     109**Filter by Author:**
     110```
     111[inspqu author="Einstein"]                  → Show quotes by Einstein only
     112[inspqu author="Einstein,Steve Jobs"]       → Show quotes by multiple authors
     113[inspqu author="Einstein" limit="5"]        → Show 5 quotes by Einstein
     114```
     115
     116**Limit Results:**
     117```
     118[inspqu limit="10"]                         → Show only 10 quotes
     119[inspqu category="Motivation" limit="5"]    → Show 5 quotes from Motivation category
     120```
     121
     122**Order Quotes:**
     123```
     124[inspqu orderby="date"]                     → Sort by date (oldest first)
     125[inspqu orderby="date" order="DESC"]        → Sort by date (newest first)
     126[inspqu orderby="author" order="ASC"]       → Sort alphabetically by author
     127[inspqu orderby="id" order="DESC"]          → Sort by ID (newest first)
     128[inspqu category="Motivation" orderby="date" order="DESC"] → Latest Motivation quotes
     129```
     130
     131**Display Specific Quote:**
     132```
     133[inspqu id="42"]                            → Display quote with ID 42
     134```
     135
     136**Exclude Quotes:**
     137```
     138[inspqu exclude="1,2,3"]                    → Show all quotes except IDs 1, 2, and 3
     139[inspqu category="Motivation" exclude="5,6"] → Motivation quotes excluding IDs 5 and 6
     140```
     141
     142**Filter by Status:**
     143```
     144[inspqu status="active"]                    → Show only active quotes (default)
     145[inspqu status="draft"]                     → Show only draft quotes
     146[inspqu status="all"]                       → Show all quotes (active + draft)
     147```
     148
     149**Combined Advanced Examples:**
     150```
     151[inspqu category="Motivation" limit="5" orderby="date" order="DESC"]
     152→ Show 5 latest quotes from Motivation category
     153
     154[inspqu author="Einstein" limit="10" timer="15"]
     155→ Show 10 quotes by Einstein, rotating every 15 seconds
     156
     157[inspqu category="Success" author="Steve Jobs" limit="3"]
     158→ Show 3 quotes from Success category by Steve Jobs
     159
     160[inspqu category="Motivation" exclude="1,2,3" orderby="author" order="ASC"]
     161→ Show Motivation quotes (excluding IDs 1-3), sorted alphabetically by author
     162
     163[inspqu design="Gradient Glow Box" category="Life" limit="8" orderby="date" timer="12"]
     164→ Beautiful gradient design with 8 latest Life quotes, rotating every 12 seconds
    88165```
    89166
     
    228305* 🌍 **Added Arabic Language Support** – Plugin is now available in Arabic, making it accessible to a wider global audience.
    229306
     307= 1.5 =
     308* 🎯 **Advanced Shortcode Parameters** – Added powerful filtering and sorting capabilities:
     309  * Filter quotes by category (name or ID, supports multiple categories)
     310  * Filter quotes by author (supports multiple authors)
     311  * Limit number of quotes displayed
     312  * Order quotes by date, author, ID, or random
     313  * Sort direction (ASC/DESC) control
     314  * Display specific quote by ID
     315  * Exclude specific quote IDs
     316  * Filter by quote status (active, draft, or all)
     317  * All parameters can be combined for precise quote selection
     318
    230319== Upgrade Notice ==
    231320
     
    245334= 1.4 =
    246335🌍 **Arabic Language Support Added** – Plugin's Admin Interface is now available in Arabic.
     336
     337= 1.5 =
     338🎯 **Advanced Shortcode Parameters Added** – New powerful filtering and sorting features allow you to:
     339* Filter quotes by category and author
     340* Limit and order results with flexible options
     341* Display specific quotes or exclude certain ones
     342* Combine multiple parameters for precise control
     343Check the Shortcodes section for detailed examples and usage instructions.
Note: See TracChangeset for help on using the changeset viewer.