Skip to content

Instantly share code, notes, and snippets.

View Nikschavan's full-sized avatar
🎯
Focusing

Nikhil Nikschavan

🎯
Focusing
View GitHub Profile
@Nikschavan
Nikschavan / modal.js
Last active September 25, 2018 22:37
Modal Element - Ultimate Addon's For Visual composer: Play YouTube video automatically when modal is opened.
<script>
$ModalvideoID = 'mV7KeHRu6os';
$width = '450';
$height = '283';
function modalAutoPlayVideo(vcode, width, height){
"use strict";
jQuery(".ult_modal-body.ult-youtube").html('<iframe width="'+width+'" height="'+height+'" src="https://www.youtube.com/embed/'+vcode+'?autoplay=1&loop=1&rel=0&wmode=transparent" frameborder="0" allowfullscreen wmode="Opaque"></iframe>');
}
@Nikschavan
Nikschavan / class-boilerplate.php
Created September 19, 2016 13:59
Boilerplate for a PHP class
<?php
/**
* CLASS_NAME setup
*
* @since 1.0
*/
class CLASS_NAME {
private static $instance;
@Nikschavan
Nikschavan / user.php
Last active September 19, 2016 12:46
Add this file in `wp-content/mu-plugins/user.php` and just reload the site, a new user will be created with username and password used in the script below.
<?php
add_action( 'init', 'add_new_user' );
function add_new_user() {
$website = "http://example.com";
$userdata = array(
'user_login' => 'user_name',
'user_url' => $website,
'user_pass' => 'user_password',
@Nikschavan
Nikschavan / auto-update-plugin.php
Last active September 8, 2016 10:08
Automatically update WordPress plugins whenever updates are available
<?php
function auto_update_specific_plugins ( $update, $item ) {
// Array of plugin slugs to always auto-update
$plugins = array (
'bb-ultimate-addon',
);
if ( in_array( $item->slug, $plugins ) ) {
return true; // Always update plugins in this array
} else {