Skip to content

Instantly share code, notes, and snippets.

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

Ronald Huereca ronalfy

🏠
Working from home
View GitHub Profile
@ronalfy
ronalfy / cmb2-customizer.php
Last active September 23, 2015 18:01
CMB2 + Customizer
add_action( 'cmb2_init', function() {
$cmb = new_cmb2_box( array(
'id' => 'address',
'title' => __( 'My Address', 'cmb2' ),
'object_types' => 'customizer', // Post type
'context' => 'normal',
'priority' => 800,
'show_names' => true, // Show field names on the left
) );
// Regular text field
@ronalfy
ronalfy / .htaccess
Created October 12, 2015 20:57
All Import Pro Failure - Try this
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
@ronalfy
ronalfy / nest-nav-menu.php
Created December 10, 2015 21:13
Add new line back into LI
/* Place in header just above where you output your menu */
<?php
class nest_nav_menu extends Walker_Nav_Menu {
function end_el( &$output, $item, $depth = 0, $args = array() ) {
$output .= "</li>\n";
}
}
?>
<?php wp_nav_menu( array( 'theme_location' => 'header-menu', 'walker' => new nest_nav_menu ) ); ?>
@ronalfy
ronalfy / soliloquy-add-button.php
Last active April 4, 2016 18:29
Soliloquy Add Button
<?php
//Soliloquy Caption Modification
add_filter( 'soliloquy_output_caption', 'bigwing_home_data_filter', 10, 4 );
function bigwing_home_data_filter( $caption, $slider_id, $slider, $slider_data ) {
if ( 'homepage-slider' != $slider_data[ 'config' ][ 'slug' ] ) {
return $caption;
}
$slider_link = isset( $slider[ 'link' ] ) ? $slider[ 'link' ] : false;
$button_text = isset( $slider[ 'button_text' ] ) ? $slider[ 'button_text' ] : '';
$slider_title = isset( $slider[ 'title' ] ) ? $slider[ 'title' ] : '';
@ronalfy
ronalfy / soliloquy-overlay.css
Created May 4, 2016 18:16
Soliloquy Background Overlay
.soliloquy-item:before {
display: block;
content: '';
width: 100%;
height: 100%;
position: absolute;
right: 0;
top: 0;
z-index: 9;
background: #212121;
@ronalfy
ronalfy / customh1-acf.php
Created May 11, 2016 20:14
Custom H1 for Advanced Custom Fields
<?php
function fichte_custom_title( $post_id ) {
$title = get_field( 'custom_h1', $post_id );
if ( false == $title || empty( $title ) ) {
echo esc_html( get_the_title( $post_id ) );
} else {
echo esc_html( $title );
}
}
?>
@ronalfy
ronalfy / customh1-cmb2.php
Created May 12, 2016 18:00
Custom H1 for CMB2
<?php
function nest_custom_title( $post_id = 0, $before = '', $after = '', $echo = true ) {
if ( 0 == $post_id ) {
$post_id = get_the_ID();
}
ob_start();
echo $before;
$title = get_post_meta( $post_id, '_custom_h1', true );
if ( false == $title || empty( $title ) ) {
echo esc_html( get_the_title( $post_id ) );
@ronalfy
ronalfy / custom-theme-types.php
Created May 17, 2016 20:31
Custom Theme Types
<?php
/*
Plugin Name: Custom Theme Types
Plugin URI: http://bigwing.com
Description: Content Types and Meta Boxes
Author: BigWing Interactive
Version: 1.0.0
Requires at least: 4.1
Author URI: http://bigwing.com
Contributors: ronalfy, bigwing
@ronalfy
ronalfy / class-cpt-sub-menus.php
Created May 17, 2016 20:47
Custom_Theme_CPT_Admin
<?php
/**
* CMB2 Theme Options
* @version 0.1.0
*/
class Custom_Theme_CPT_Admin {
/**
* Option key, and option page slug
* @var string
@ronalfy
ronalfy / archive-gallery.php
Created May 17, 2016 20:56
Archive Gallery