Skip to content

Instantly share code, notes, and snippets.

View benschaaf's full-sized avatar

Ben Schaaf benschaaf

View GitHub Profile
@benschaaf
benschaaf / template.php
Created November 21, 2013 20:19
Wrap the link title in a span, that will get display none. I could have also just removed the title, but I wanted it there for SEO (I guess)
<?php
function ross_menu_link__menu_block__menu_social(array $variables) {
$element = $variables['element'];
$sub_menu = '';
if ($element['#below']) {
$sub_menu = drupal_render($element['#below']);
}
$element['#localized_options']['html'] = TRUE;
@benschaaf
benschaaf / logged-in-redirect-function
Created May 31, 2013 18:01
WordPress ~ Redirect to specific page based on logged in status.
<?php
// Add to theme functions.php
function redirect_gift_registry() {
if (is_user_logged_in() && is_page(2042)) {
wp_redirect( home_url("/shop") ); exit;
}
}
add_action('template_redirect', 'redirect_gift_registry');
?>
@benschaaf
benschaaf / gist:5489057
Last active December 16, 2015 19:59
Custom Post Type - Pagination Issue
<?php
// Registering my custom post type
// ...
register_post_type( 'news-event',
array(
'labels' => array(
'name' => __( 'News & Events' ),
'singular_name' => __( 'News & Events' )
),