Skip to content

Instantly share code, notes, and snippets.

DarioBF

Block or report user

Report or block DarioBF

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 CPTs 2
// Lo enganchamos en la acción init y llamamos a la función create_book_taxonomies() cuando arranque
add_action( 'init', 'create_book_taxonomies', 0 );
// Creamos dos taxonomías, género y autor para el custom post type "libro"
function create_book_taxonomies() {
/* Configuramos las etiquetas que mostraremos en el escritorio de WordPress */
$labels = array(
'name' => _x( 'Géneros', 'taxonomy general name' ),
'singular_name' => _x( 'Género', 'taxonomy singular name' ),
'search_items' => __( 'Buscar por Género' ),
View CPTs 1
add_action( 'init', 'bf_register_custom_post_type' );
/**
* Registro un custom post type 'libro'.
*
* @link http://codex.wordpress.org/Function_Reference/register_post_type
*/
function bf_register_custom_post_type() {
/* Añado las etiquetas que aparecerán en el escritorio de WordPress */
$labels = array(
'name' => _x( 'Libros', 'post type general name', 'text-domain' ),
View WordPress migrations
UPDATE wp_options SET option_value = replace(option_value, 'http://site-to-change.com', 'http://127.0.0.1/site-changed') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = REPLACE (guid, 'http://site-to-change.com', 'http://127.0.0.1/site-changed');
UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://site-to-change.com', 'http://127.0.0.1/site-changed');
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 'http://site-to-change.com', 'http://127.0.0.1/site-changed');
@DarioBF
DarioBF / functions.php
Created Feb 15, 2016
Change number of products per page on WooCommerce
View functions.php
// Display 24 products per page. Goes in functions.php
add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 24;' ), 20 );
@DarioBF
DarioBF / functions.php
Created Jan 26, 2016
Allow SVG files uploads in WordPress
View functions.php
/**
* Allow uploads for SVG files.
*/
function cc_mime_types($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'cc_mime_types');
/**
@DarioBF
DarioBF / Preferences.sublime-settings
Last active Feb 25, 2016
Sublime Text 3 preferences
View Preferences.sublime-settings
{
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme",
"font_options":
[
"gray_antialias",
"subpixel_antialias"
],
"font_size": 13,
You can’t perform that action at this time.