Skip to content

Instantly share code, notes, and snippets.

@joeyz
joeyz / ACF-responsive-slider
Created October 9, 2014 14:53
Replace Image sizes for mobile instead of squishing them using ACF repeater field
<?php if( have_rows('home_slider_images', options) ): ?>
<div id="maximage">
<?php while( have_rows('home_slider_images', options) ): the_row();
// vars
$image = get_sub_field('slide_image');
$imageTablet = get_sub_field('tablet_image');
//Check and see if were NOT at a mobile screen size
@joeyz
joeyz / uber-triangles
Created October 14, 2014 16:56
Add little triangles to the submenus for Uber Menu
.ubermenu-main .ubermenu-item-level-0.ubermenu-has-submenu-drop.ubermenu-active > .ubermenu-target:before{
content: '';
display:block;
border:6px solid transparent;
border-bottom-color:#fff;
position:absolute;
bottom:0;
left:50%;
margin-left:-3px;
margin-bottom:-1px;
@joeyz
joeyz / wp_dynamic_sidebar.php
Created March 30, 2015 02:51
WP dynamic sidebar
//Goes in Functions.php
// Widgetized Sidebar
function lavish_widgets_init() {
register_sidebar( array(
'name' => 'left sidebar',
'id' => 'left_sidebar',
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '<h2 class="rounded">',
@joeyz
joeyz / valign.css
Created March 25, 2015 03:39
Vertically align elements with css onluy
.parent-element {
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
transform-style: preserve-3d;
}
.element {
position: relative;
top: 50%;
transform: translateY(-50%);
@joeyz
joeyz / testimonials_cpt.php
Last active August 29, 2015 14:17
WP Testimonials CPT
<?php
// For use in functions.php
// Dont forget to re-save your permalinks so that it actually shows up.
if ( ! function_exists('custom_post_type_testimonials') ) {
// Register Custom Post Type
function custom_post_type_testimonials() {
$labels = array(
'name' => _x( 'Testimonial', 'Post Type General Name', 'twentyfifteen' ),
@joeyz
joeyz / fetchAPI.php
Created March 21, 2015 18:35
json to php object
<?php
function fetchData($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}