Skip to content

Instantly share code, notes, and snippets.

View Pseric's full-sized avatar
💭
I may be slow to respond.

Pseric Pseric

💭
I may be slow to respond.
View GitHub Profile
add_filter('mce_buttons','wysiwyg_editor');
function wysiwyg_editor($mce_buttons) {
$pos = array_search('wp_more',$mce_buttons,true);
if ($pos !== false) {
$tmp_buttons = array_slice($mce_buttons, 0, $pos+1);
$tmp_buttons[] = 'wp_page';
$mce_buttons = array_merge($tmp_buttons, array_slice($mce_buttons, $pos+1));
}
return $mce_buttons;
}
if ( current_user_can('contributor') && !current_user_can('upload_files') )
add_action('admin_init', 'allow_contributor_uploads');
function allow_contributor_uploads() {
$contributor = get_role('contributor');
$contributor->add_cap('upload_files');
}
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/zh_TW/sdk.js#xfbml=1&version=v2.6";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-quote"></div>
add_filter( 'amp_post_template_analytics', 'xyz_amp_add_custom_analytics' );
function xyz_amp_add_custom_analytics( $analytics ) {
if ( ! is_array( $analytics ) ) {
$analytics = array();
}
// https://developers.google.com/analytics/devguides/collection/amp-analytics/
$analytics['xyz-googleanalytics'] = array(
'type' => 'googleanalytics',
'attributes' => array(
<div data-video="VIDEO_ID"
data-autoplay="0"
data-loop="1"
id="youtube-audio">
</div>
<script src="https://www.youtube.com/iframe_api"></script>
<script src="https://cdn.rawgit.com/labnol/files/master/yt.js"></script>
@Pseric
Pseric / index.js
Created November 10, 2016 08:07 — forked from fkztw/index.js
佛祖保佑 永無 BUG (May Budda bless you no bug forever)
//
// _oo0oo_
// o8888888o
// 88" . "88
// (| -_- |)
// 0\ = /0
// ___/`---'\___
// .' \\| |// '.
// / \\||| : |||// \
// / _||||| -:- |||||- \
@Pseric
Pseric / Facebook-SDK.htm
Created November 30, 2017 04:27
Facebook JavaScript SDK
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'your-app-id',
autoLogAppEvents : true,
xfbml : true,
version : 'v2.11'
});
};
@Pseric
Pseric / facebook-customer-chat-plugin.htm
Created November 30, 2017 04:31
Facebook Customer Chat Plugin
<div class="fb-customerchat"
page_id="<PAGE_ID>"
ref="<OPTIONAL_WEBHOOK_PARAM>"
minimized="<true|false>">
</div>
<script type='text/javascript' src='https://c0.wp.com/c/4.9.8/wp-includes/js/jquery/jquery.js'></script>
<script type='text/javascript' src='https://c0.wp.com/c/4.9.8/wp-includes/js/jquery/jquery-migrate.min.js'></script>
<link rel='stylesheet' id='jetpack_css-css' href='https://c0.wp.com/p/jetpack/6.6.1/css/jetpack.css' type='text/css' media='all' />
<link rel='stylesheet' id='dashicons-css' href='https://c0.wp.com/c/4.9.8/wp-includes/css/dashicons.min.css' type='text/css' media='all' />
<link rel='stylesheet' id='admin-bar-css' href='https://c0.wp.com/c/4.9.8/wp-includes/css/admin-bar.min.css' type='text/css' media='all' />
<link rel='stylesheet' id='genericons-css' href='https://c0.wp.com/p/jetpack/6.6.1/_inc/genericons/genericons/genericons.css' type='text/css' media='all' />
<link rel='stylesheet' id='twentysixteen-jetpack-css' href='https://c0.wp.com/p/jetpack/6.6.1/modules/theme-tools/compat/twentysixteen.css' type='text/css' media='all' />