Skip to content

Instantly share code, notes, and snippets.

@westonruter
westonruter / wp-42573.php
Last active June 14, 2024 18:17
WP Trac #42573: Fix for theme template caching. https://core.trac.wordpress.org/ticket/42573
<?php
/**
* Plugin name: WP Trac #42573: Fix for theme template file caching.
* Description: Flush the theme file cache each time the admin screens are loaded which uses the file list.
* Plugin URI: https://core.trac.wordpress.org/ticket/42573
* Author: Weston Ruter, XWP.
* Author URI: https://weston.ruter.net
*/
function wp_42573_fix_template_caching( WP_Screen $current_screen ) {
<?php
global $wp_embed;
$video_url = 'https://www.youtube.com/watch?v=b7mixrO2lzA';
echo $wp_embed->run_shortcode( '[embed]' . $video_url . '[/embed]' );
@ShinichiNishikawa
ShinichiNishikawa / add_body_class_locale.php
Last active August 29, 2015 14:02
Add locale to body_class
// add locale such as locale_ja, locale_en_US to body class
add_filter( 'body_class', 'add_body_class_locale' );
function add_body_class_locale( $classes ) {
$classes[] = 'locale_' . sanitize_html_class( get_bloginfo('language') );
return $classes;
}
@michaelv
michaelv / facebook-mass-delete-group-members.js
Created April 21, 2014 15:00
This javascript removes all users from a facebook group. It works with the new facebook layout. Paste this in the javascript console. Script tested in Firefox. Known issues: 1. when facebook responds slowly, the script might experience hickups.. 2. occasionially, the error 'this user is not a member of the group' pops up.. IMPORTANT: add your ow…
var deleteAllGroupMembers = (function () {
var deleteAllGroupMembers = {};
// the facebook ids of the users that will not be removed.
// IMPORTANT: add your own facebook id here so that the script will not remove yourself!
var excludedFbIds = ['1234','11223344']; // make sure each id is a string!
var usersToDeleteQueue = [];
var scriptEnabled = false;
var processing = false;
deleteAllGroupMembers.start = function() {
@gatespace
gatespace / gist:9966808
Last active June 7, 2017 11:02
WordPress で Bogo を使った多言語サイトでのカスタム投稿タイプ http://qiita.com/gatespace/items/75e70f5ae162c2962dcc
add_filter('bogo_localizable_post_types', 'my_localizable_post_types', 10, 1);
function my_localizable_post_types($localizable) {
$localizable[] = 'custom_post_type_name';
return $localizable;
}
@kasparsd
kasparsd / wordpress-plugin-svn-to-git.md
Last active August 16, 2024 17:33
Using Git with Subversion Mirroring for WordPress Plugin Development
@Gab-km
Gab-km / github-flow.ja.md
Last active October 29, 2024 10:17 — forked from juno/github-flow.ja.md
GitHub Flow (Japanese translation)
@wokamoto
wokamoto / replace-siteurl.php
Created September 4, 2012 23:22
WordPress のDB上のサイトURLを一気に変換
#!/usr/bin/php
<?php
switch($argc) {
case 1:
case 2:
echo "please input new site url and wp directory name!\n";
exit();
default:
$old_site = isset($argv[3]) ? $argv[3] : '';
$path = $argv[2];
@hrstt
hrstt / git_rm_all.sh
Created June 19, 2012 04:59
ファイル削除後にgit rm を一括でする
git status | grep deleted: | awk '{print $3}' | xargs git rm
# ただしカラースキーム付きの場合は保証しない.