Skip to content

Instantly share code, notes, and snippets.

Milan Dinić dimadin

Block or report user

Report or block dimadin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dimadin
dimadin / conditional-simple-colorbox.php
Last active Dec 30, 2015
Used in combination with (heavily) modified Simple Colorbox plugin.
View conditional-simple-colorbox.php
<?php
if ( class_exists( 'Simple_Colorbox' ) ) :
/**
* Conditional Simple Colorbox loader.
*
* Enqueue Colorbox files only when needed on page to improve
* performance by avoiding unnecessary external requests and
* inline content.
*
* If Colorbox is needed only when galleries are used,
@dimadin
dimadin / gist:4247291
Created Dec 9, 2012
Filter WordPress admin bar text
View gist:4247291
/**
* Filter admin bar strings.
*/
function md_filter_admin_bar_strings( $translation, $original_text, $domain ) {
if ( 'About WordPress' == $original_text )
$translation = 'About this site';
return $translation;
}
@dimadin
dimadin / gist:4247285
Created Dec 9, 2012
Load only admin bar translation on WordPress frontend
View gist:4247285
/**
* Set en_US lang code if not in admin.
*/
function md_set_en_us_locale( $locale ) {
if ( ! is_admin() ) {
if ( ! defined( 'MD_REAL_LANG' ) )
define( 'MD_REAL_LANG', $locale );
$locale = 'en_US';
}
@dimadin
dimadin / export.php
Created Jul 29, 2015
GlotPress Serbian transliteration
View export.php
<?php
function __construct() {
$this->short_options .= 'o:v:';
$this->usage .= ' [-o <format (default=po)>] [-v <variant>]';
$this->add_filters_to_options_and_usage();
parent::__construct();
}
function action_on_translation_set( $translation_set ) {
@dimadin
dimadin / curly-quotes.php
Created May 11, 2015
Filtering WordPress curly quotes
View curly-quotes.php
<?php
function md_filter_curly_double_quotes( $translations, $text, $context, $domain ) {
if ( 'opening curly double quote' == $context && '&#8220;' == $text ) {
$translations = '&#0171;';
} else if ( 'closing curly double quote' == $context && '&#8221;' == $text ) {
$translations = '&#0187;';
}
return $translations;
@dimadin
dimadin / gist:e4445d21002ccdade530
Last active Aug 29, 2015
WP Links Widgets Customizing
View gist:e4445d21002ccdade530
<?php
/**
* Replace <ul> from blogroll widget with <div>.
*/
function md_replace_ul_blogroll( $output ) {
$output = str_replace( "<ul class='xoxo blogroll'>", "<div>", $output );
$output = str_replace( "</ul>", "</div>", $output );
return $output;
}
You can’t perform that action at this time.