Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View bi0xid's full-sized avatar
🏠
In Seville

Rafa Poveda bi0xid

🏠
In Seville
View GitHub Profile
@bi0xid
bi0xid / p2-recommended-plugins
Created September 27, 2012 10:40
P2 recommended plugins
@bi0xid
bi0xid / mime-type-mp3.php
Last active December 26, 2015 18:29
Add mime type MP3
<?php
add_filter('upload_mimes','add_custom_mime_types');
function add_custom_mime_types($mimes){
return array_merge($mimes,array (
'mp3' => 'audio/mp3'
));
}
@bi0xid
bi0xid / wp_meta_query.php
Last active August 29, 2015 14:01
WP_Query with meta query
<?php
// Ejemplo complejo. Post Type 'historia', con un campo 'fecha_de_entrega' numérico (YYYYMMDD), y otro campo 'pila'.
$args = array(
'post_type' => 'historia',
'meta_key' => 'fecha_de_entrega',
'orderby' => 'meta_value_num',
'nopaging' => 'true',
'order' => 'ASC',
@bi0xid
bi0xid / wg-change-email-alert.php
Last active August 29, 2015 14:01
WangGuard - Admin Email Alerts for WordPress
<?php
//** Admin Email Alerts for WordPress
// Original @ Josh Lobe - WP Admin Alerts For Profile Updates
// http://pastebin.com/XY4bgiZX
// WangGuard version @ Rafa Poveda
// https://gist.github.com/bi0xid/cd1896f7be881d02398f
/*
@bi0xid
bi0xid / datebox-18-buddypress.php
Last active September 23, 2022 18:52
BuddyPress Datebox +18 (you have to be at least 18)
<?php
/**
* Datebox +18 xprofile field type.
*
* @since BuddyPress (2.0.1)
* @author bi0xid
*/
class BP_XProfile_Field_Type_Datebox18 extends BP_XProfile_Field_Type {
@bi0xid
bi0xid / no-hyphens.css
Created May 29, 2014 08:59
Eliminate hyphens in twenty thirteen and other WordPress themes
.entry-content {
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
@bi0xid
bi0xid / responsive-iframe.html
Created June 10, 2014 06:18
Responsive iframe
<html>
<head>
<title>TITLE</title>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0 maximum-scale=1.0" />
<style type="text/css">
body {width:100%;height:100%;margin:0;overflow:hidden;background-color:#252525;}
#iframe {position:absolute;left:0px;top:0px;}
</style>
</head>
<body>
@bi0xid
bi0xid / add-cpt-as-front-page.php
Created June 23, 2014 11:45
Add CPT as front page
<?php
add_filter( 'get_pages', 'add_my_cpt' );
function add_my_cpt( $pages )
{
$my_cpt_pages = new WP_Query( array( 'post_type' => 'my_cpt' ) );
if ( $my_cpt_pages->post_count > 0 )
{
$pages = array_merge( $pages, $my_cpt_pages->posts );
}
@bi0xid
bi0xid / wp_query.php
Last active August 29, 2015 14:05
WP Query
<?php
* The WordPress Query class.
* @link http://codex.wordpress.org/Function_Reference/WP_Query
*
*/
$args = array(
//Post & Page Parameters
'p' => 1,
'name' => 'hello-world',
@bi0xid
bi0xid / add_mimetype.php
Created August 19, 2014 15:54
Add mimetype
<?php
add_filter('upload_mimes', 'custom_upload_mimes');
function custom_upload_mimes ( $existing_mimes = array() ) {
// add your extension to the array
$existing_mimes['patch'] = 'text/plain';
$existing_mimes['diff'] = 'text/plain';
$existing_mimes['po'] = 'text/plain';
$existing_mimes['conf'] = 'text/plain';
$existing_mimes['mo'] = 'text/plain';
$existing_mimes['rtf'] = 'text/rtf';