Skip to content

Instantly share code, notes, and snippets.

View jayarjo's full-sized avatar
👻
Here, but elsewhere.

Davit Barbakadze jayarjo

👻
Here, but elsewhere.
View GitHub Profile
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Plupload - Custom example</title>
<!-- production -->
<script type="text/javascript" src="../js/plupload.full.min.js"></script>
$callback = $_REQUEST['callback'];
// Create the output object.
$output = array('a' => 'Apple', 'b' => 'Banana');
//start output
if ($callback) {
header('Content-Type: text/javascript');
echo $callback . '(' . json_encode($output) . ');';
} else {
@jayarjo
jayarjo / gist:46bd7d2e3007a2350639
Created April 10, 2015 14:57
wp: additional sizes for insert into post
function f__image_size_names_choose( $sizes ) {
global $_wp_additional_image_sizes;
if ( empty($_wp_additional_image_sizes) )
return $sizes;
foreach ( $_wp_additional_image_sizes as $id => $data ) {
if ( !isset($sizes[$id]) )
$sizes[$id] = ucfirst( str_replace( '-', ' ', $id ) );
}
return $sizes;
@jayarjo
jayarjo / gist:6cec6da6f22bd8aed79b
Created April 11, 2015 09:41
wp: hide default logos
function a__login_head()
{
echo '<style type="text/css">h1 a { background: none !important; }</style>';
}
function a__admin_head()
{
echo '<style type="text/css">#wp-admin-bar-wp-logo { display: none !important; }</style>';
}
@jayarjo
jayarjo / editor_plugin.js
Created March 9, 2012 08:24 — forked from dnaber-de/editor_plugin.js
Wordpress TinyMCE Popup-Dialog. German Tutorial on http://dnaber.de/p1477
// js/editor_plugin.js
/**
* an example tinyMCE Plugin
*/
tinymce.create(
'tinymce.plugins.myPlugin',
{
/**
* @param tinymce.Editor editor
* @param string url
@jayarjo
jayarjo / gist:4182073
Created December 1, 2012 12:42
Preload Images
// preload images
function preloadImages() {
var items = [], current = 0, errors = [], timer;
var resetTimer = function() {
stopTimer();
startTimer();
};
@jayarjo
jayarjo / gist:4523490
Last active December 11, 2015 01:29
Plupload - Queue widget example
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Plupload - Queue widget example</title>
<link rel="stylesheet" href="../../js/jquery.plupload.queue/css/jquery.plupload.queue.css" type="text/css" media="screen" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript" src="../../js/plupload.full.min.js"></script>
@jayarjo
jayarjo / gist:4696711
Created February 2, 2013 09:13
wp: add/modify columns in post type listing screens
function f__manage_posts_columns($cols)
{
global $typenow;
if ($typenow != 'price_table')
return $cols;
$cols = array(
'cb' => $cols['cb'],
'title' => $cols['title'],
'template' => "Template",
@jayarjo
jayarjo / gist:4708136
Created February 4, 2013 17:23
wp: insert navigation menu
<?php wp_nav_menu(array(
'theme_location' => "top",
'container' => false,
'menu_id' => 'menu-top'
)); ?>
@jayarjo
jayarjo / gist:4721061
Last active December 12, 2015 05:19
redirect non-www to www
# ignore specific path (/administrator/ - in this case)
RewriteCond %{REQUEST_URI} ^/?administrator($|\/|\/.*) [NC]
RewriteRule ^.*$ - [NC,L]
# redirect non-www to www
RewriteCond %{HTTP_HOST} ^yoursite\.com [NC]
RewriteRule ^(.*)$ http://www.yoursite.com/$1 [R=301,L]