Skip to content

Instantly share code, notes, and snippets.

Avatar
👻
Here, but elsewhere.

Davit Barbakadze jayarjo

👻
Here, but elsewhere.
View GitHub Profile
View gist:6cec6da6f22bd8aed79b
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 / gist:46bd7d2e3007a2350639
Created Apr 10, 2015
wp: additional sizes for insert into post
View gist:46bd7d2e3007a2350639
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;
View gist:27e61105ba917eb3816a
$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 {
View custom2.html
<!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>
@jayarjo
jayarjo / gist:7750154
Created Dec 2, 2013
php: getters and setters alternative
View gist:7750154
function __set($property, $value)
{
switch ($property) {
case 'host':
if (!preg_match("{^https?://}", $value)) {
$value = "http://$value";
}
// use internal php facilities to get pure host
if ($url_parts = parse_url($value)) {
@jayarjo
jayarjo / gist:7614316
Last active Dec 29, 2015
wp: do not update specific plugin (handy when it's modified)
View gist:7614316
add_filter( 'http_request_args', 'eshop_prevent_update_check', 10, 2 );
function eshop_prevent_update_check( $r, $url )
{
if ( false !== strpos( $url, 'api.wordpress.org/plugins/update-check/' ) ) {
$my_plugin = plugin_basename( __FILE__ );
$plugins = unserialize( $r['body']['plugins'] );
unset( $plugins->plugins[$my_plugin] );
unset( $plugins->active[array_search( $my_plugin, $plugins->active )] );
$r['body']['plugins'] = serialize( $plugins );
}
@jayarjo
jayarjo / gist:7558816
Created Nov 20, 2013
wp: re-attach images from other posts or pages
View gist:7558816
function f__manage_upload_columns($columns)
{
unset($columns['parent']);
$columns['better_parent'] = "Parent";
return $columns;
}
function a_0_2__manage_media_custom_column($column_name, $id)
{
@jayarjo
jayarjo / gist:7528355
Created Nov 18, 2013
wp: trigger media manager and default to "uploaded to this post" tab.
View gist:7528355
<button class="button" onclick="wp.media.editor.open(this);jQuery('select.attachment-filters [value=uploaded]').attr( 'selected', true ).parent().trigger('change');return false;">Manage Media...</button>
@jayarjo
jayarjo / gist:7415058
Last active Dec 28, 2015
wp: remove logo from wp login screen.
View gist:7415058
function a__login_head()
{
echo '<style type="text/css">h1 a { background: none !important; }</style>';
}
View fiddle.html
<div id="container">
<div id="filelist">No runtime found.</div>
<br />
<a id="pickfiles" href="javascript:;">[Select files]</a>
<a id="uploadfiles" href="javascript:;">[Upload files]</a>
</div>