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 / admin-stylesheet
Created October 8, 2014 19:36
Add admin css sheet based on user ID(good for hiding admin menu)
// custom admin style sheet
function my_admin_head() {
$whodat = get_current_user_id();
if ($whodat == 2) {
echo '<link href="' .get_bloginfo('stylesheet_directory'). '/css/admin-menu.css" rel="stylesheet" type="text/css">';
}
}
add_action('admin_head', 'my_admin_head');
@joeyz
joeyz / widgetarea
Created October 8, 2014 14:48
Add top widgeted area in a genesis theme
/** Register Topads widget area */
genesis_register_sidebar( array(
'id' => 'topads',
'name' => __( 'Hero Area', 'custom-theme' ),
'description' => __( 'Here you can place a hero ad or a slider', 'custom-theme' ),
) );
/** Add topads widget after the primary menu */
@joeyz
joeyz / WP Loop with pagination
Last active August 29, 2015 14:07
Wordpress Pagination for archive page
//Dont forget to set how many items you want on each page in "Settings > Reading > Blog pages show at most"
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
// WP_Query arguments
$args = array (
'pagination' => true,
'paged' => $paged,
'order' => 'ASC'
);