Plugin Directory

Changeset 2896629


Ignore:
Timestamp:
04/10/2023 01:46:06 PM (3 years ago)
Author:
aliparsa
Message:

feature : add new endpoint for get count of products

Location:
pasazh/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pasazh/trunk/pasazh.php

    r2841766 r2896629  
    66Plugin URI: https://epasazh.com
    77Description: با استفاده از این افزونه میتوانید فروشگاه خود را به پاساژ متصل نمایید. کافیست آن را فعال نمایید پس از آن به پنل مدیریت خودت در وب سایت پاساژ مراجعه نموده و ادامه مراحل جهت اتصال را تکمیل نمایید.
    8 Version: 1.8
     8Version: 1.9
    99Author: aliparsa
    1010Author URI: https://profiles.wordpress.org/aliparsa/
     
    2525
    2626add_action('rest_api_init', function () {
     27    register_rest_route('papi', '/products/count', array(
     28        'methods' => 'GET',
     29        'callback' => 'PASAZHAPI_products_count',
     30    ));
     31});
     32
     33add_action('rest_api_init', function () {
    2734    register_rest_route('papi', '/info', array(
    2835        'methods' => 'GET',
     
    4956    return new WP_REST_Response($response, 200);
    5057
     58}
     59
     60function PASAZHAPI_products_count(){
     61    return new WP_REST_Response(wp_count_posts('product'), 200);
    5162}
    5263
  • pasazh/trunk/readme.txt

    r2841766 r2896629  
    55Requires at least: 5.0.3
    66Tested up to: 5.9.3
    7 Stable tag: 1.8
     7Stable tag: 1.9
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2323== Screenshots ==
    2424== Changelog ==
    25 = 1.8 =
     25= 1.9 =
    2626* First release
    2727== Upgrade Notice ==
Note: See TracChangeset for help on using the changeset viewer.