Skip to content

Instantly share code, notes, and snippets.

View ideag's full-sized avatar

Arūnas Liuiza ideag

View GitHub Profile
@ideag
ideag / old-plugin.php
Created September 1, 2015 12:36
WordPress rename plugin main PHP file
<?php
/*
Plugin Name: Old Plugin main file
Description: Rename Old plugin main file (i.e. index.php) to `plugin-slug.php`
Version: 0.1.0
Author: Arūnas Liuiza
Author URI: http://arunas.co
License: GPL2
*/
@ideag
ideag / tinyconcept.php
Last active August 29, 2015 14:24
a concept snippet for WordPress plugin to ensure it always enqueues the latest available version of FontAwesome via BootstrapCDN. Makes use of jsDelivr API to find the latest version of FontAwesome.
<?php
add_action( 'plugins_loaded', array( 'tinyConcept', 'init' ) );
register_activation_hook( __FILE__, array( 'tinyConcept', 'activate' ) );
register_deactivation_hook( __FILE__, array( 'tinyConcept', 'deactivate' ) );
class tinyConcept {
private static $fontawesome = '4.2.0';
// init plugin
public static function init() {
@ideag
ideag / functions.php
Created July 12, 2015 07:45
Vary menu based on some logic (user role, current page, etc.)
<?php
// ...
register_nav_menu( 'primary', __( 'Primary default location', 'yourtheme' ) );
register_nav_menu( 'primary-subscriber', __( 'Primary subscriber location', 'yourtheme' ) );
register_nav_menu( 'primary-account', __( 'Primary account location', 'yourtheme' ) );
// ...
?>
@ideag
ideag / block.js
Created May 12, 2015 08:25
Block context menu on right click
jQuery(document).on( "mousedown", function(event) {
if("3" == event.which ) {
document.oncontextmenu = document.body.oncontextmenu = function() {return false;}
}
});
@ideag
ideag / edwinfrontpage.php
Last active November 19, 2015 22:15
A snippet to allow a CPT post to be selected as the Front Page in WordPress.
<?php
/*
Plugin Name: EdwinFrontPage
Plugin URI: https://gist.github.com/ideag/f97d513e84b523bd2dac
Description: Enable CPT posts to be set as front page. Usage: EdwinFrontPage::init( 'your_custom_post_type' ); Should be run on 'init' hook.
Author: Arūnas Liuiza
Version: 0.1.0
Author URI: http://arunas.co/
*/
@ideag
ideag / arunas-hides-plugins.php
Last active October 1, 2019 21:13
A simple proof-of-concept plugin to hide specific plugins from Plugins' list in WP Admin if it is a Multisite install and the user is not the Super Administrator.
<?php
/*
Plugin Name: Arunas Hides Plugins
Plugin URI: http://arunas.co/hidesplugins
Description: A simple proof-of-concept plugin to hide specific plugins from Plugins' list in WP Admin if it is a Multisite install and the user is not the Super Administrator.
Author: Arūnas Liuiza
Version: 0.2
Author URI: http://arunas.co/
*/
@ideag
ideag / publish.sh
Created April 7, 2015 10:59
Publishes from git repository to wordpress.org plugin directory via svn. It expects the git repo to sit in /git subfolder.
#!/bin/bash
# args
VERSION=${1}
MSG=${2-'Deploy from git'}
COMMIT=${3-true}
UPDATE_ALL=${4-true}
if [ ! ${VERSION} ]; then
echo 'Error: no version given'
@ideag
ideag / spameriams.md
Created March 6, 2015 11:07
spameriams

Jūs puikiai žinote, kad Jūsų naujienlaiškio neužsisakinėjau, o tiesioginė rinkodara be išankstinio naudotojo sutikimo yra Elektroninių ryšių įstatymo 69 straipsnio 1 dalies pažeidimas. El. pašto adresų duombazių pirkimas taip pat yra Asmens duomenų apsaugos įstatymo pažeidimas, kurį Jūs padarėte.

Pranešu, kad kreipsiuosi į Asmens duomenų apsaugos inspekciją dėl neteisėto el. pašto adresų duombazių pirkimo bei Valstybinę vartotojų teisių apsaugos tarnybą dėl be mano sutikimo man siunčiamos tiesioginės rinkodaros. Jūsų bendrovės partneriai ir potencialūs klientai neabejotinai apsidžiaugs sužinoję, kad bendrovė yra bausta administracine tvarka už ATPK 214-14 str. ir 189-14 str. pažeidimus.

@ideag
ideag / activate_twentyfourteen.sql
Created November 24, 2014 11:30
Activate WordPress „Twenty Fourteen“ (default) theme via SQL in case of WSOD (White Screen of Death), due to error in functions.php
UPDATE `wp_options` SET `option_value` = 'twentyfourteen' WHERE ( `option_name` = 'template' ) OR ( `option_name` = 'stylesheet' )
<!DOCTYPE html>
<html>
<head></head>
<body></body>
</html>