Skip to content

Instantly share code, notes, and snippets.

View SErr0r's full-sized avatar

Gennady Yudenko SErr0r

View GitHub Profile
@SErr0r
SErr0r / transparency.js
Last active December 15, 2015 10:49
Прозрачность объектов IMG
// ***** Прозрачность объектов IMG ***** //
$(document).ready(function(){
$("#transparency img").fadeTo("slow", 0.6); // Эта строчка при загрузке страницы задает всем миниатюрам прозрачность равную 60%
$("#transparency img").hover(function(){
$(this).fadeTo("slow", 1.0); // Делаем картинку непрозрачной, при наведении мыши
},function(){
$(this).fadeTo("slow", 0.6); // Снова возвращаем прозрачность 60%, при отведении мыши
});
});
@SErr0r
SErr0r / functions.php
Created March 7, 2015 21:06
Удаляем заголовок записи в WordPress
remove_action( 'genesis_post_title','genesis_do_post_title' );
@SErr0r
SErr0r / functions.php
Created March 7, 2015 21:10
Определяем пользователя с мобильного телефона в WordPress
<?php
if( wp_is_mobile() ) {
// echo the "HAVE YOU TRIED OUR AWESOME MOBILE APP?" banner
} else {
// don't echo the banner
}
?>
@SErr0r
SErr0r / functions.php
Created April 20, 2015 01:00
Запретить пользователям доступ в панель администратора WordPress
add_action( 'init', 'blockusers_init' );
function blockusers_init() {
if ( is_admin() && ! current_user_can( 'administrator' ) &&
! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
wp_redirect( home_url() );
exit;
}
}
@SErr0r
SErr0r / wp-config.php
Created April 22, 2015 07:52
Отключить редактирование файлов WordPress
//Disable File Edits
define('DISALLOW_FILE_EDIT', true);
@SErr0r
SErr0r / functions.php
Created April 25, 2015 14:49
Подтверждение информации для входа (Login Error Message)
function failed_login () {
return 'the login information you have entered is incorrect.';
}
add_filter ( 'login_errors', 'failed_login' );
@SErr0r
SErr0r / functions.php
Created April 26, 2015 08:42
Redirect WordPress Failed Logins back to homepage
// will redirect back to the blog's home page
wp_login_form(array('redirect'=> site_url()));
@SErr0r
SErr0r / functions.php
Created April 26, 2015 08:44
Redirect WordPress Failed Logins to custom location
// hook failed login
add_action('wp_login_failed', 'my_front_end_login_fail');
function my_front_end_login_fail($username){
// Get the reffering page, where did the post submission come from?
$referrer = $_SERVER['HTTP_REFERER'];
// if there's a valid referrer, and it's not the default log-in screen
if(!empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin')){
// let's append some information (login=failed) to the URL for the theme to use
wp_redirect($referrer . '?login=failed');
@SErr0r
SErr0r / whois.tld.json
Created October 30, 2015 00:34
Update server definitions
{
".ae.org": {
"host": "whois.centralnic.com"
},
".ar.com": {
"host": "whois.centralnic.com"
},
".br.com": {
"host": "whois.centralnic.com"
},
@SErr0r
SErr0r / resize.php
Created November 7, 2015 20:51
Simple PHP Image Resizer
<?php
session_start();
header("Pragma: public");
header("Cache-Control: max-age = 604800");
header("Expires: ".gmdate("D, d M Y H:i:s", time() + 604800)." GMT");
function thumbnail($image, $width, $height) {
if($image[0] != "/") { // Decide where to look for the image if a full path is not given
if(!isset($_SERVER["HTTP_REFERER"])) { // Try to find image if accessed directly from this script in a browser
$image = $_SERVER["DOCUMENT_ROOT"].implode("/", (explode('/', $_SERVER["PHP_SELF"], -1)))."/".$image;