Skip to content

Instantly share code, notes, and snippets.

View dsebao's full-sized avatar
🏠
Working from home

Sebastian Ortiz dsebao

🏠
Working from home
View GitHub Profile
@dsebao
dsebao / function.php
Created March 10, 2014 15:44
Use email instead of loginname in WP
<?php
/*
*
*
* Usar mails para el login en vez de usuarios
*
*
*/
remove_filter( 'authenticate', 'wp_authenticate_username_password', 20, 3 );
@dsebao
dsebao / script.js
Created March 28, 2014 04:24
WP easy AJAX pagination
jQuery(function($) {
$('#content').on('click', '#pagination a', function(e){
e.preventDefault();
var link = $(this).attr('href');
$('#content').fadeOut(500, function(){
$(this).load(link + ' #content', function() {
$(this).fadeIn(500);
});
});
});
@dsebao
dsebao / function.php
Created March 28, 2014 04:25
Remove submenu in Admin Bar WordPress
<?php
/*
*
*
* REMOVER WORDPRESS SUBMENU EN ADMIN BAR
*
*
*/
if (!current_user_can('administrator')):
@dsebao
dsebao / function.php
Created March 28, 2014 04:26
Let editors manage users in WordPress
<?php
// let editor manage users
$edit_editor = get_role('editor'); // Get the user role
$edit_editor->add_cap('list_users');
$edit_editor->add_cap('create_users');
$edit_editor->add_cap('delete_users');
// hide admin from user list
add_action('pre_user_query','isa_pre_user_query');
@dsebao
dsebao / style.css
Created March 28, 2014 04:36
Better fonts in browser
.myElement{
-webkit-font-smoothing: antialiased;
}
.myElement{
-webkit-text-shadow: rgba(0,0,0,.01) 0 0 1px;
}
/*Font face?*/
@font-face {
@dsebao
dsebao / functions.php
Created March 28, 2014 04:37
Remove update notification in WP
<?php
add_action('admin_menu','wphidenag');
function wphidenag() {
remove_action( 'admin_notices', 'update_nag', 3 );
}
?>
@dsebao
dsebao / index.php
Created April 10, 2014 04:33
Show the first image of every folders finding in a root dir in WordPress
<?php
/*
In this example bfithumb (https://github.com/bfintal/bfi_thumb) is
include in functions.php for the thumbnails
The folders have the id gallery, name of the gallery and the date in his name.
eg: 123_mytitle_02.12.2014
*/
$search = dirname(__FILE__) . "/{foldername}/";
@dsebao
dsebao / index.php
Created April 10, 2014 18:50
Simple Slideimg with jQuery (WP)
<div class="bgslide">
<img src="<?php bloginfo('template_url');?>/images/slide1.png" class="active">
<img src="<?php bloginfo('template_url');?>/images/slide2.png">
</div>
@dsebao
dsebao / script.js
Created May 7, 2014 18:37
Redirect in js
window.setTimeout(function(){
window.location.href = "https://www.google.com";
}, 3000);
@dsebao
dsebao / functions.php
Created June 2, 2014 20:25
get_thecategory unlinked in WP
<?php
function the_category_unlinked($separator = ' ') {
$categories = (array) get_the_category();
$thelist = '';
foreach($categories as $category) { // concate
$thelist .= $separator . $category->category_nicename;
}
echo $thelist;
}
?>