Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

roose roose

🏠
Working from home
Block or report user

Report or block roose

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
View change_img_src.php
<?php
//Этот фильтр меняет ссылку на файл только на морде сайта:
function change_image_src($content) {
return preg_replace('/src="([^"]+)"/', 'src="http://src.sencha.io/sw/$1"', $content);
}
add_filter( 'the_content', 'change_image_src' );
//Этот меняет ссылку на файл при сохранении/обновлении поста:
@roose
roose / support.placeholde.js
Created May 24, 2012
Cross-Browser Support for HTML5 Placeholder Text in Forms
View support.placeholde.js
$.support.placeholder = false;
test = document.createElement('input');
if('placeholder' in test) $.support.placeholder = true;
if(!$.support.placeholder) {
var active = document.activeElement;
$(':text').focus(function () {
if ($(this).attr('placeholder') != '' && $(this).val() == $(this).attr('placeholder')) {
$(this).val('').removeClass('hasPlaceholder');
}
@roose
roose / future_core_login.php
Created May 12, 2012 — forked from franz-josef-kaiser/future_core_login.php
A WordPress plugin to build an environment to develop a single stylesheet for the login/reg/pass screen in WP 3.1
View future_core_login.php
<?php
/**
* Plugin Name: Future Core Login
* Plugin URI: http://unserkaiser.com
* Description: Replacing the current stylesheets loaded on wp-login.php until this ticket goes into core: <a href="http://core.trac.wordpress.org/ticket/12506">#12506</a>
* Version: 0.1
* Author: Franz Josef Kaiser
* Author URI: http://unserkaiser.com
* License: GPL2
*
@roose
roose / gist:2216211
Created Mar 27, 2012
Qtranslate. Custom Taxonomies Admin Edit Screen Fix
View gist:2216211
<?php
function qtranslate_edit_taxonomies(){
$args=array(
'public' => true ,
'_builtin' => false
);
$output = 'object'; // or objects
$operator = 'and'; // 'and' or 'or'
@roose
roose / gist:1933129
Created Feb 28, 2012
Wordpress languages block(Qtranslate)
View gist:1933129
<?php
function get_qlang(){
global $q_config;
foreach(qtrans_getSortedLanguages() as $language) {
if(is_404()) $url = get_option('home'); else $url = '';
echo '<li';
if($language == $q_config['language']) echo ' class="current"';
echo '><a href="'.qtrans_convertURL($url, $language).'"';
@roose
roose / gist:1933115
Created Feb 28, 2012
Change Wordpress login page logo&link
View gist:1933115
<?php
add_action( 'login_head', 'ilc_custom_login');
function ilc_custom_login() {
echo '<style type="text/css">
h1 a { background-image:url('. get_stylesheet_directory_uri() . '/images/logo2.png' . ') !important; margin-bottom: 10px; }
padding: 20px;}
</style>
<script type="text/javascript">window.onload = function(){document.getElementById("login").getElementsByTagName("a")[0].href = "'. home_url() . '";document.getElementById("login").getElementsByTagName("a")[0].title = "Go to site";}</script>';
}
@roose
roose / gist:1933109
Created Feb 28, 2012
Change "Thank you for creating with WordPress." in admin footer to custom text
View gist:1933109
<?php
function modify_footer_admin () {
echo 'Developed by <a href="http://roose.kz">roose</a>.';
}
add_filter('admin_footer_text', 'modify_footer_admin');
?>
@roose
roose / gist:1933052
Created Feb 28, 2012
Disable dashboard widgets in Wordpress Dashboard
View gist:1933052
<?php
function disable_default_dashboard_widgets() {
remove_meta_box('dashboard_recent_comments', 'dashboard', 'core');
remove_meta_box('dashboard_incoming_links', 'dashboard', 'core');
remove_meta_box('dashboard_plugins', 'dashboard', 'core');
remove_meta_box('dashboard_quick_press', 'dashboard', 'core');
remove_meta_box('dashboard_recent_drafts', 'dashboard', 'core');
remove_meta_box('dashboard_primary', 'dashboard', 'core');
remove_meta_box('dashboard_secondary', 'dashboard', 'core');
@roose
roose / gist:1933047
Created Feb 28, 2012
Remove menu in Wordpress admin menu
View gist:1933047
<?php
function remove_menus () {
global $menu;
$restricted = array(__('Links'), __('Posts'));
end ($menu);
while (prev($menu)){
$value = explode(' ',$menu[key($menu)][0]);
if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
}
@roose
roose / gist:1933030
Created Feb 28, 2012
Excerpt more string & length
View gist:1933030
<?php
function go_excerpt( $more ) {
return '...';
}
add_filter( 'excerpt_more', 'go_excerpt' );
function go_excerpt_length( $length ) {
return 30;
}
add_filter( 'excerpt_length', 'go_excerpt_length' );
You can’t perform that action at this time.