Skip to content

Instantly share code, notes, and snippets.

@retgef
retgef / wysiwyg-meta-box.php
Created September 10, 2011 02:06
How to add a Wordpress WYSIWYG editor to a meta box.
<?php
define('WYSIWYG_META_BOX_ID', 'my-editor');
define('WYSIWYG_EDITOR_ID', 'myeditor'); //Important for CSS that this is different
define('WYSIWYG_META_KEY', 'extra-content');
add_action('admin_init', 'wysiwyg_register_meta_box');
function wysiwyg_register_meta_box(){
add_meta_box(WYSIWYG_META_BOX_ID, __('WYSIWYG Meta Box', 'wysiwyg'), 'wysiwyg_render_meta_box', 'post');
}
@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;
}
@wokamoto
wokamoto / gist:5771b3b0b9b83d2e1642
Last active December 7, 2023 07:53
[PHP] Google Calendar API v3 から祝日取得
<?php
function get_holidays_this_month($year, $month){
// 月初日
$first_day = mktime(0, 0, 0, intval($month), 1, intval($year));
// 月末日
$last_day = strtotime('-1 day', mktime(0, 0, 0, intval($month) + 1, 1, intval($year)));
$api_key = 'YOUR API KEY HERE';
$holidays_id = 'outid3el0qkcrsuf89fltf7a4qbacgt9@import.calendar.google.com'; // mozilla.org版
@sterlingwes
sterlingwes / tourney.html
Created December 3, 2012 23:42
Tournament Bracket Generator (Javascript + CSS, no tables)
<!DOCTYPE html>
<html>
<head>
<title>Tournament Bracket Generator</title>
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script src="http://underscorejs.org/underscore-min.js"></script>
<script>
$(document).on('ready', function() {
var knownBrackets = [2,4,8,16,32], // brackets with "perfect" proportions (full fields, no byes)
@gatespace
gatespace / exclude-algolia-search.php
Last active January 14, 2022 08:39
WordPress + Algoliaで、Algoliaの検索対象から特定の投稿(固定ページ)を除外するプラグイン
<?php
/*
Plugin Name: Exclude Algolia search
Plugin URI:
Description: Algolia の検索結果から除外するフラグを追加。WP Search with Algolia プラグインが必要。
Version: 0.1
Author: gatespace
Author URI: https://gatespace.jp
License: GPLv2 or later
*/
@galengidman
galengidman / search.php
Last active September 26, 2021 16:45
WordPress search form & results for custom post type
<?php
// check to see if there is a post type in the URL
if ( isset( $_GET['post_type'] ) && $_GET['post_type'] ) {
// save it for later
$post_type = $_GET['post_type'];
// check to see if a search template exists
if ( locate_template( 'search-' . $post_type . '.php' ) ) {
@fumikito
fumikito / request.php
Created March 2, 2017 08:07
A typical jQuery request to WordPress REST API
<?php
/**
* Regsiter script
*/
add_action( 'wp_enqueue_scripts', function() {
// Set dependency to wp-api, which has nonce and endpoint root.
wp_enqueue_script( 'api-handler', '/path/to/api-handler.js', [ 'jquery', 'wp-adpi' ], '1.0', true );
} );

BASE API v1 ドキュメント (β版)

BASEのAPIの開発者向けのドキュメントです。

概要

このAPIを使うと、あなたのアプリケーションとBASEを連携させることができます。

例えば

  • BASEのアカウントでログインする
  • BASEのショップの商品情報を取得する
<?php
/**
* Get Google Page Speed Screenshot
*
* Uses Google's Page Speed API to generate a screenshot of a website.
* Returns the image as a base64 jpeg image tag
*
* Usage Example:
* echo getGooglePageSpeedScreenshot("http://ghost.org", 'class="thumbnail"');
*
@miya0001
miya0001 / tello.js
Last active January 30, 2019 18:36
Tello + Node.js example
#!/usr/bin/env node
'use strict'
const PORT = 8889;
const HOST = '192.168.10.1';
const dgram = require('dgram');
const client = dgram.createSocket('udp4');