Skip to content

Instantly share code, notes, and snippets.

<?php
function ignacio_import_hack( $value ) {
if ( ! post_type_exists( 'et_pb_layout' ) ) {
register_post_type( 'et_pb_layout' );
}
if ( ! taxonomy_exists( 'layout_type' ) ) {
register_taxonomy( 'layout_type', 'et_pb_layout' );
}
@igmoweb
igmoweb / nbt-pro-sites.php
Last active October 23, 2015 15:04
NBT + Pro Sites integration
<?php
add_filter( 'psts_setting_checkout_url', 'katarzyna_nbt_pro_sites_checkout_url' );
function katarzyna_nbt_pro_sites_checkout_url( $value ) {
global $pagenow, $psts;
if ( ! is_object( $psts ) )
return $value;
$show_signup = $psts->get_setting( 'show_signup' );
@igmoweb
igmoweb / functions.php
Created September 4, 2015 10:20
Sparkling Child
<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
@igmoweb
igmoweb / kirki-hooks.php
Created September 1, 2015 17:51
Repeater Kirki Hooks. First attempt in a good direction, maybe
<?php
add_action( 'customize_register', 'kirki_hooks_customize_register' );
function kirki_hooks_customize_register( $wp_customize ) {
class Kirki_Customize_Control_Repeater_Setting extends WP_Customize_Setting {
/**
* In Repeater, one setting is one row full of settings
* fields save all the fields and their types
@igmoweb
igmoweb / ale.php
Last active August 29, 2015 14:27
functions.php
if ( ! function_exists('generate_concerts_post_type') ) {
// Register Custom Post Type
function generate_concerts_post_type() {
$labels = array(
'name' => _x( 'Concerts', 'Post Type General Name', 'ale' ),
'singular_name' => _x( 'Concert', 'Post Type Singular Name', 'ale' ),
'menu_name' => __( 'Concerts', 'ale' ),
#!/bin/bash
BROWSER_PATH='open /Applications/Google\ Chrome.app'
if [[ $# -eq 0 ]] ; then
echo "Please enter a version number:"
read VERSION
else
VERSION=$1
fi
@igmoweb
igmoweb / posts-list.php
Created June 23, 2015 17:30
posts-list-shortcode
<?php
add_shortcode( 'posts-list', 'ignacio_posts_list_shortcode' );
function ignacio_posts_list_shortcode( $atts ) {
$defaults = array(
'items' => 3
);
$atts = wp_parse_args( $atts, $defaults );
@igmoweb
igmoweb / the-category.php
Created June 21, 2015 19:06
alex the category
<?php
/**
* En lugar de usaar the_category( ' | ' ), usa alex_the_category( ' | ' )
* Añadee una clase CSS a cada link en la lista. Si tu categoría se llama "Mi Categoría",
* la clase será "cat-mi-categoria"
*
* Si no le metes el parámetro separator, va a salir feo.
*/
function alex_the_category( $separator = '' ) {
global $wp_rewrite;
@igmoweb
igmoweb / uploader.js
Created March 17, 2015 13:49
uploader.js
// Esto es lo que crea wp_localize_script ( no lo tienes que poner en tu fichero):
media_files_i18n = {
conti: 'John Conti', // O su versión traducida, si la hay
my_string: 'My String' // O su versión traducida, si la hay
};
// Y ahora, dentrode uploader.js, simplemente puedes usar:
var my_name = media_files_i18n.conti
@igmoweb
igmoweb / conti.php
Created March 17, 2015 13:43
conti
<?php
function media_files_tools_load_js(){
wp_enqueue_media();
wp_enqueue_script('media_files_tools_load_js' , "/" . PLUGINDIR . '/media-files-tools/js/uploader.js' , array('jquery'),'2.0');
$object = array(
'conti' => __( 'John Conti', 'conti' ),
'my_string' => __( 'My String', 'conti' )
);