This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add your Google Maps API key, preferrably in wp-config.php or in the database. | |
define( 'GOOGLE_MAPS_API_KEY', '' ); | |
function acf_google_map_api( $api ) { | |
$api['key'] = GOOGLE_MAPS_API_KEY; | |
return $api; | |
} | |
add_filter( 'acf/fields/google_map/api', 'acf_google_map_api' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const hubspot = require("@hubspot/api-client"); | |
const { config } = require("dotenv"); | |
config(); | |
/** | |
* The HubSpot class lets you interact with the HubSpot API. | |
* @see https://github.com/HubSpot/hubspot-api-nodejs | |
*/ | |
class HubSpot { | |
constructor(accessToken) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { OpenAI: client } = require("openai"); | |
const { config } = require("dotenv"); | |
config(); | |
/** | |
* Class for interacting with OpenAI API. | |
*/ | |
class OpenAI { | |
constructor({ apiKey }) { | |
this.client = new client({ apiKey }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { Pinecone: PineconeClient } = require("@pinecone-database/pinecone"); | |
const { config } = require("dotenv"); | |
config(); | |
/** | |
* Class for interacting with Pinecone API. | |
*/ | |
class Pinecone { | |
constructor() { | |
try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The BlockKitBuilder class is a utility class that helps you build | |
* blocks for the Slack Block Kit. While the Block Kit is a JSON-based | |
* DSL (Domain Specific Language), this class provides a more readable | |
* and maintainable way to construct blocks. | |
*/ | |
class BlockKitBuilder { | |
addSection({ text, type = "mrkdwn" }) { | |
return { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Displays a custom taxonomy meta box with radio inputs. | |
* | |
* @param WP_Post $post Current post object. | |
* @param array $box Categories meta box arguments. | |
* @return void | |
*/ | |
function toms_custom_meta_box_with_radio_inputs( WP_Post $post, array $box ): void { | |
$tax_name = esc_attr( $box['args']['taxonomy'] ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'init', 'toms_custom_taxonomy' ); | |
/** | |
* Registers a custom taxonomy with a custom meta box callback, and without | |
* an edit functionality within Quick Edit. | |
* | |
* @return void | |
*/ | |
function toms_custom_taxonomy(): void { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Walker class to output an unordered list of taxonomy radio input elements. | |
*/ | |
class Walker_Taxonomy_Radio_List extends Walker { | |
public $db_fields = array( | |
'parent' => '', | |
'id' => 'term_id', | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Displays a custom taxonomy meta box without adder. | |
* | |
* @param WP_Post $post Current post object. | |
* @param array $box Categories meta box arguments. | |
* @return void | |
*/ | |
function toms_custom_meta_box_without_adder( WP_Post $post, array $box ): void { | |
$tax_name = esc_attr( $box['args']['taxonomy'] ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'pre_get_posts', 'toms_restrict_media_library_to_user_list_view' ); | |
add_action( 'pre_get_posts', 'toms_restrict_media_library_to_user_tile_view' ); | |
/** | |
* Restrict media library to user's own uploads in list view. | |
* | |
* @param WP_Query $query | |
* @return void | |
*/ |
NewerOlder