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
function chapel_project_metaboxes(array $meta_boxes) | |
{ | |
// underscore hides meta box from custom field list | |
$prefix = '_chapel_'; | |
$meta_boxes ['project_metabox'] = array( | |
'id' => 'project_metabox', | |
'title' => __('Project Overview', 'cmb2'), | |
'object_types' => array( 'project'), |
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 | |
/* | |
Plugin Name: Custom Feed Importer | |
Plugin URI: https://premium.wpmudev.org/ | |
Description: It will try fetch feeds with file_get_contents | |
Author: Panos Lyrakis @ WPMUDEV | |
Author URI: https://premium.wpmudev.org/ | |
License: GPLv2 or later | |
*/ |
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_filter( 'submit_job_form_wp_editor_args', 'smyles_submit_job_form_wp_editor_args' ); | |
function smyles_submit_job_form_wp_editor_args( $args ){ | |
// @see https://github.com/Automattic/WP-Job-Manager/blob/master/templates/form-fields/wp-editor-field.php#L2 | |
// change quicktags to true | |
$args['quicktags'] = true; | |
// change rows to 10 (default is 8) |
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
$response = $client->chat()->create([ | |
'model' => 'gpt-3.5-turbo-16k-0613', | |
'messages' => $messages, | |
'functions' => [ | |
[ | |
'name' => 'search_job_post', | |
'description' => 'Search for a job based on a search query.', | |
'parameters' => [ | |
'type' => 'object', | |
'properties' => [ |
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('rest_api_init', 'register_rest_routes' ); | |
function register_rest_routes(){ | |
// URL will be /wp-json/custom-route/v1/add-list | |
register_rest_route( 'custom-route/v1', 'add-list',array( | |
'methods' => 'POST', | |
'callback' => array('Custom_InfusionWP', 'add_list'), | |
'permission_callback' => function() { |
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 | |
/** | |
* Subscribe user | |
*/ | |
function subscribe_user(WP_REST_Request $request) { | |
// $params = $request->get_params(); | |
// $email = $params['email']; | |
$email = $request->get_param('email'); | |
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
class My_REST_Posts_Controller { | |
// Here initialize our namespace and resource name. | |
public function __construct() { | |
$this->namespace = '/my-namespace/v1'; | |
$this->resource_name = 'posts'; | |
} | |
// Register our routes. | |
public function register_routes() { |
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 | |
/* 1. add function to rest_api_init hook, */ | |
/* 2. then, call register_rest_route() function */ | |
add_action( 'rest_api_init', 'define_endpoint'); | |
function define_endpoint(){ | |
register_rest_route( 'namespace', '/new/route', array( | |
'methods' => array('POST','GET','UPDATE','DELETE'), | |
'callback' => 'my_awesome_func' | |
) ); | |
} |
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 | |
// Plaats deze code in het functions.php bestand van je WordPress Child Theme | |
add_action( 'add_attachment', 'fws_set_image_alt_after_upload' ); | |
function fws_set_image_alt_after_upload( $post_ID ) { | |
if ( wp_attachment_is_image( $post_ID ) ) { | |
$post = get_post( $post_ID ); | |
update_post_meta( $post_ID, '_wp_attachment_image_alt', $post->post_title ); | |
} | |
} |
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 | |
// Plaats deze code in het functions.php bestand van je WordPress Child Theme | |
add_action( 'add_attachment', 'fws_set_image_alt_after_upload' ); | |
function fws_set_image_alt_after_upload( $post_ID ) { | |
if ( wp_attachment_is_image( $post_ID ) ) { | |
$post = get_post( $post_ID ); | |
update_post_meta( $post_ID, '_wp_attachment_image_alt', $post->post_title ); | |
} | |
} |