Plugin Directory

Changeset 1887062


Ignore:
Timestamp:
06/04/2018 08:58:27 PM (8 years ago)
Author:
factor1
Message:

Add permalinks to responses

Location:
better-rest-endpoints/trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • better-rest-endpoints/trunk/CHANGELOG.md

    r1817679 r1887062  
    77## [Unreleased]
    88n/a
     9
     10## [1.2.1] - 2018-06-04
     11### Added
     12- Permalinks to all page/post endpoints
    913
    1014## [1.2.0] - 2018-02-07
  • better-rest-endpoints/trunk/README.md

    r1817679 r1887062  
    268268- Tag IDs
    269269- ACF fields, if applicable
     270
     271## Hooks and Filters
     272
     273### Filter the Custom Post Types endpoints
     274
     275```php
     276add_filter('better_rest_endpoints_cpt_collection', function($cpt_collection){
     277    $cpt_collection = array_flip($cpt_collection);
     278    unset($cpt_collection['oembed_cache']);
     279    unset($cpt_collection['_pods_template']);
     280    unset($cpt_collection['_pods_pod']);
     281    unset($cpt_collection['_pods_field']);
     282    $cpt_collection = array_values( array_flip($cpt_collection) );
     283    return $cpt_collection;
     284});
     285```
  • better-rest-endpoints/trunk/includes/create_cpt_endpoints.php

    r1817679 r1887062  
    6868
    6969                // get post data
     70                $permalink = get_permalink();
    7071                $bre_post->id = get_the_ID();
    7172                $bre_post->title = get_the_title();
    72                 $bre_post->slug = basename(get_permalink());
     73                $bre_post->slug = basename($permalink);
     74                $bre_post->permalink = $permalink;
    7375                $bre_post->date = get_the_date('c');
    7476                $bre_post->excerpt = get_the_excerpt();
  • better-rest-endpoints/trunk/includes/get_cpt_by_id.php

    r1806011 r1887062  
    4848
    4949                // get post data
     50                $permalink = get_permalink();
    5051                $bre_cpt_post->id = get_the_ID();
    5152                $bre_cpt_post->title = get_the_title();
    52                 $bre_cpt_post->slug = basename(get_permalink());
     53                $bre_cpt_post->slug = basename($permalink);
     54                $bre_cpt_post->permalink = $permalink;
    5355                $bre_cpt_post->date = get_the_date('c');
    5456                $bre_cpt_post->excerpt = get_the_excerpt();
  • better-rest-endpoints/trunk/includes/get_cpt_by_slug.php

    r1806011 r1887062  
    4848
    4949                // get post data
     50                $permalink = get_permalink();
    5051                $bre_cpt_post->id = get_the_ID();
    5152                $bre_cpt_post->title = get_the_title();
    52                 $bre_cpt_post->slug = basename(get_permalink());
     53                $bre_cpt_post->slug = basename($permalink);
     54                $bre_cpt_post->permalink = $permalink;
    5355                $bre_cpt_post->date = get_the_date('c');
    5456                $bre_cpt_post->excerpt = get_the_excerpt();
  • better-rest-endpoints/trunk/includes/get_cpts.php

    r1806011 r1887062  
    3030  }
    3131
     32  $bre_cpts = apply_filters( 'better_rest_endpoints_cpt_collection', $bre_cpts );
     33
    3234  // check if array is empty, returns array if data exists, return false if empty
    3335  if( !empty($bre_cpts) ){
  • better-rest-endpoints/trunk/includes/get_page_by_id.php

    r1806011 r1887062  
    2828      $bre_page = new stdClass();
    2929
     30      $permalink = get_permalink();
    3031      $bre_page->id = get_the_ID();
    3132      $bre_page->title = get_the_title();
    32       $bre_page->slug = basename(get_permalink());
     33      $bre_page->slug = basename($permalink);
     34      $bre_page->permalink = $permalink;
    3335
    3436      /*
  • better-rest-endpoints/trunk/includes/get_pages.php

    r1817679 r1887062  
    6161       *
    6262       */
     63      $permalink = get_permalink();
    6364      $bre_page->id = get_the_ID();
    6465      $bre_page->title = get_the_title();
    65       $bre_page->slug = basename(get_permalink());
     66      $bre_page->slug = basename($permalink);
     67      $bre_page->permalink = $permalink;
    6668
    6769      /*
  • better-rest-endpoints/trunk/includes/get_post_by_id.php

    r1809677 r1887062  
    2626      $bre_post = new stdClass();
    2727
     28      $permalink = get_permalink();
    2829      $bre_post->id = get_the_ID();
    2930      $bre_post->title = get_the_title();
    30       $bre_post->slug = basename(get_permalink());
     31      $bre_post->slug = basename($permalink);
     32      $bre_post->permalink = $permalink;
    3133      $bre_post->date = get_the_date('c');
    3234      $bre_post->excerpt = get_the_excerpt();
  • better-rest-endpoints/trunk/includes/get_post_by_slug.php

    r1809677 r1887062  
    2727      $bre_post = new stdClass();
    2828
     29      $permalink = get_permalink();
    2930      $bre_post->id = get_the_ID();
    3031      $bre_post->title = get_the_title();
    31       $bre_post->slug = basename(get_permalink());
     32      $bre_post->slug = basename($permalink);
     33      $bre_post->permalink = $permalink;
    3234      $bre_post->date = get_the_date('c');
    3335      $bre_post->excerpt = get_the_excerpt();
  • better-rest-endpoints/trunk/includes/get_posts.php

    r1817679 r1887062  
    6161
    6262      // get post data
     63      $permalink = get_permalink();
    6364      $bre_post->id = get_the_ID();
    6465      $bre_post->title = get_the_title();
    65       $bre_post->slug = basename(get_permalink());
     66      $bre_post->slug = basename($permalink);
     67      $bre_post->permalink = $permalink;
    6668      $bre_post->date = get_the_date('c');
    6769      $bre_post->excerpt = get_the_excerpt();
  • better-rest-endpoints/trunk/includes/get_posts_tax.php

    r1817679 r1887062  
    7979
    8080                  // get post data
     81                  $permalink = get_permalink();
    8182                  $bre_tax_post->id = get_the_ID();
    8283                  $bre_tax_post->title = get_the_title();
    83                   $bre_tax_post->slug = basename(get_permalink());
     84                  $bre_tax_post->slug = basename($permalink);
     85                  $bre_tax_post->permalink = $permalink;
    8486                  $bre_tax_post->date = get_the_date('c');
    8587                  $bre_tax_post->excerpt = get_the_excerpt();
  • better-rest-endpoints/trunk/includes/get_search.php

    r1817679 r1887062  
    5353
    5454      // get post data
     55      $permalink = get_permalink();
    5556      $bre_post->id = get_the_ID();
    5657      $bre_post->title = get_the_title();
    57       $bre_post->slug = basename(get_permalink());
     58      $bre_post->slug = basename($permalink);
     59      $bre_post->permalink = $permalink;
    5860      $bre_post->date = get_the_date('c');
    5961      $bre_post->excerpt = get_the_excerpt();
  • better-rest-endpoints/trunk/package-lock.json

    r1817679 r1887062  
    11{
    22  "name": "better-rest-endpoints",
    3   "version": "1.2.0",
     3  "version": "1.2.1",
    44  "lockfileVersion": 1,
    55  "requires": true,
  • better-rest-endpoints/trunk/package.json

    r1817679 r1887062  
    11{
    22  "name": "better-rest-endpoints",
    3   "version": "1.2.0",
     3  "version": "1.2.1",
    44  "description": "Serves up slimmer WordPress Rest API endpoints.",
    55  "main": "index.js",
  • better-rest-endpoints/trunk/readme.txt

    r1817679 r1887062  
    77Requires at least: 4.7.1
    88Tested up to: 4.9.4
    9 Stable Tag: 1.2.0
     9Stable Tag: 1.2.1
    1010License: GNU Version 3 or Any Later Version
    1111
     
    4343== Changelog ==
    4444
     45= 1.2.1, June 4, 2018 =
     46* Add: Permalinks to all post/page endpoints
     47
    4548= 1.2.0, Febuary 7, 2018 =
    4649* Add: ACF query in endpoint url to hide acf values from the response where applicable (all collections)
Note: See TracChangeset for help on using the changeset viewer.