Skip to content

Instantly share code, notes, and snippets.

View bryanrsebastian's full-sized avatar

Bryan Sebastian bryanrsebastian

View GitHub Profile
function wpse27856_set_content_type(){
return "text/html";
}
add_filter( 'wp_mail_content_type','wpse27856_set_content_type' );
function myprefix_custom_cron_schedule( $schedules )
{
$schedules['everysecond'] = array(
'interval' => 1, // everysecond
'display' => __( 'Every second' ),
/**
* Get some data in facebook profile
*/
$.ajaxSetup( { cache: true } );
$.getScript( '//connect.facebook.net/en_US/sdk.js', function() {
FB.init( {
appId: '224429194748109',
version: 'v2.7' // or v2.1, v2.2, v2.3, ...
} );
$( '#link-fb' ).removeClass('disabled');
@bryanrsebastian
bryanrsebastian / Autoheight selector using jquery
Last active September 20, 2017 01:06
By using this function you can set the height of all elements dynamically base on the max height of the selector.
( function( $ ) {
/**
* Script On Document Ready
*/
autoHeight( '[selector]' );
/**
* Script On Resize
*/
$( window ).resize( function() {
<?php
/**
* Disable Gravity Form Post Creation
*/
function disable_post_creation( $is_disabled, $form, $entry ) {
return true;
}
add_filter( 'gform_disable_post_creation', 'disable_post_creation', 10, 3 );
<?php
/*
* Enable Hidden Labels in form builder
* /
add_filter( 'gform_enable_field_label_visibility_settings', '__return_true' );
<?php
/**
* Include all php inside the folder
* @param string $folder folder name
* @return void include all the php inside the folder that you enter.
*/
if ( ! function_exists( 'include_all_php' ) )
{
function include_all_php( $folder )
{
<?php
/**
* Global checker
* @param string/array $var the function will check this variable
* @return boolean true if not empty, not null, is set, and not equal to ''.
*/
if ( ! function_exists( 'checker' ) ) {
function checker( $var ) {
return ( $var && $var != '' && ! empty( $var ) && ! is_null( $var ) );
}
@bryanrsebastian
bryanrsebastian / Youtube API
Created September 22, 2017 08:18
Play youtube by clicking the custom icon.
/* YouTube API */
var tag = document.createElement( 'script' );
tag.src = "//www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName( 'script' )[0];
firstScriptTag.parentNode.insertBefore( tag, firstScriptTag );
var player;
onYouTubeIframeAPIReady = function () {
player = new YT.Player( 'player', {
add_filter( 'ajax_query_attachments_args', 'show_users_own_attachments', 1, 1 );
function show_users_own_attachments( $query )
{
global $current_user;
if( in_array( 'merchant', $current_user->roles ) )
$query['author'] = $current_user->ID;
return $query;
}