Plugin Directory

Changeset 2927416


Ignore:
Timestamp:
06/17/2023 09:16:13 PM (21 months ago)
Author:
firmcatalyst
Message:

fixed the api sanitize, pll friendly added

Location:
fcp-posts-by-search-query/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • fcp-posts-by-search-query/trunk/README.md

    r2908720 r2927416  
    1111* Implement with the \[fcppbk\] shortcode
    1212* It minifies the css before printing
     13* Polylang friendly
    1314
    1415## Demo
  • fcp-posts-by-search-query/trunk/inc/meta-boxes.php

    r2907638 r2927416  
    132132                    'description' => 'The search query',
    133133                    'type'        => 'string',
     134                    'required'    => true,
    134135                    'validate_callback' => function($param) {
    135136                        return trim( $param ) ? true : false;
    136137                    },
    137                     'sanitize_settings' => function($param, $request, $key) {
     138                    'sanitize_callback' => function($param, \WP_REST_Request $request, $key) {
    138139                        return sanitize_text_field( urldecode( $param ) ); // return htmlspecialchars( wp_unslash( urldecode( $param ) ) );
    139140                    },
     
    199200            $search = new \WP_Query( [
    200201                //'post_type' => get_types_to_search_among(), // commented to keep on accident save. filter still works in shortcode
     202                'post_type' => 'any',
    201203                //'post_status' => 'publish', // same
    202204                'post__in' => $ids,
    203205                'orderby' => 'post__in',
     206                'lang' => 'all', // ++ add the option to limit languages if needed
    204207            ] );
    205208            if ( $search->have_posts() ) {
  • fcp-posts-by-search-query/trunk/inc/shortcode.php

    r2907638 r2927416  
    66defined( 'ABSPATH' ) || exit;
    77
    8 add_shortcode( FCPPBK_SLUG, function() {
     8add_shortcode( FCPPBK_SLUG, function() { // ++!! what if it is outside the loop!!
    99
    1010    if ( is_admin() ) { return; }
     
    4545    }
    4646
     47    // wp_reset_query(); // ++ investigate when to apply
    4748
    4849    $metas = array_map( function( $value ) { // get the meta values
     
    6566        'posts_per_page' => $limit,
    6667        'post__not_in' => [ $current_id ], // exclude self
     68        'lang' => 'all',
    6769    ];
    6870
  • fcp-posts-by-search-query/trunk/posts-by-query.php

    r2908719 r2927416  
    33Plugin Name: FCP Posts by Search Query
    44Description: Implement a list of relevant posts to particular pages with a search query or exact list of posts. Easy pick and add.
    5 Version: 1.0.1
     5Version: 1.0.2
    66Requires at least: 5.8
    77Tested up to: 6.2
    8 Requires PHP: 7.4
     8Requires PHP: 8.0
    99Author: Firmcatalyst, Vadim Volkov, Aude Jamier
    1010Author URI: https://firmcatalyst.com
  • fcp-posts-by-search-query/trunk/readme.txt

    r2908720 r2927416  
    44Requires at least: 5.8
    55Tested up to: 6.2
    6 Requires PHP: 7.4
    7 Stable tag: 1.0
     6Requires PHP: 8.0
     7Stable tag: 1.0.2
    88Author: Firmcatalyst, Vadim Volkov, Aude Jamier
    99Author URI: https://firmcatalyst.com
     
    2525* Implement with the \[fcppbk\] shortcode
    2626* It minifies the css before printing
     27* Polylang friendly
    2728
    2829= Demo =
Note: See TracChangeset for help on using the changeset viewer.