Skip to content

Instantly share code, notes, and snippets.

@aaronhayes
aaronhayes / Currencies.md
Last active October 3, 2022 15:58
Common Currencies Array JSON
@mahlamusa
mahlamusa / extend-wp-rest-api.php
Last active June 1, 2023 10:38
Extend WordPress REST API with custom rest fields and endpoints
<?php
/**
* Register custom rest fields
*/
add_action( 'rest_api_init', 'register_custom_fields' );
/**
* Register rest fields and endpoint
*
@simonhamp
simonhamp / AppServiceProvider.php
Last active March 26, 2024 15:56
A pageable Collection implementation for Laravel
<?php
namespace App\Providers;
use Illuminate\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
class AppServiceProvider extends ServiceProvider
{
public function boot()
@charleslouis
charleslouis / custom-search-acf-wordpress.php
Last active December 15, 2023 09:11
PHP - Wordpress - Search - wordpress custom search function that encompasses ACF/advanced custom fields and taxonomies and split expression before request
<?php
/**
* [list_searcheable_acf list all the custom fields we want to include in our search query]
* @return [array] [list of custom fields]
*/
function list_searcheable_acf(){
$list_searcheable_acf = array("title", "sub_title", "excerpt_short", "excerpt_long", "xyz", "myACF");
return $list_searcheable_acf;
}
@justinhernandez
justinhernandez / gist:630770
Created October 17, 2010 11:39
pretty array export for var_export
function pretty_var($myArray){
print str_replace(array("\n"," "),array("<br>","&nbsp;"), var_export($myArray,true))."<br>";
}