Skip to content

Instantly share code, notes, and snippets.

Sjouw

Block or report user

Report or block Sjouw

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Sjouw
Sjouw / cf7-plugin.php
Created Jun 30, 2015
Contact Form 7 (3.8) - change recipient based on zipcode
View cf7-plugin.php
<?php
/*
Plugin Name: Contact Form 7 Zipcode check
Plugin URI: http://youruri.com/
Description:
Author:
Version: 1.0
Author URI:
*/
@Sjouw
Sjouw / functions.php
Created Feb 10, 2015
WordPress - Show dynamic menu title above menu
View functions.php
function get_theme_menu_name( $theme_location ) {
if ( !has_nav_menu( $theme_location ) ) return false;
$menus = get_nav_menu_locations();
$menu_title = wp_get_nav_menu_object( $menus[$theme_location] )->name;
return $menu_title;
}
@Sjouw
Sjouw / latest-posts.php
Created Dec 18, 2014
WordPress - Sidebar latest posts widget with toggle dropdown for small screens
View latest-posts.php
<?php
// Get the poststype of the current post
$posttype = get_post_type();
$obj = get_post_type_object( $posttype );
$args = array (
'post_type' => $posttype,
'post_status' => 'publish',
'post_count' => 5
@Sjouw
Sjouw / latest-posts.php
Created Dec 18, 2014
WordPress - Better latest posts sidebar menu widget with active states
View latest-posts.php
<?php
// Get the poststype of the current post
$posttype = get_post_type();
$obj = get_post_type_object( $posttype );
$args = array (
'post_type' => $posttype,
'post_status' => 'publish',
'post_count' => 5
@Sjouw
Sjouw / custom.php
Created Dec 9, 2014
WordPress - Add description to featured image field
View custom.php
/*
* Add description to Featured image box
*/
function new_post_thumbnail_meta_box() {
global $post;
$thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true ); // grabing the thumbnail id of the post
echo _wp_post_thumbnail_html( $thumbnail_id ); // echoing the html markup for the thumbnail
@Sjouw
Sjouw / checkbox.html
Last active Aug 29, 2015
CSS yes/no switch from checkbox
View checkbox.html
<div class="checkbox-wrap">
<input name="checkbox1" type="checkbox" value="Yes" checked="checked" id="checkbox1">
<label for="checkbox1" id="label1">Yes</label>
</div>
@Sjouw
Sjouw / custom.php
Last active Aug 29, 2015
Quickscan with redirect to resultpage (using Gravity Forms)
View custom.php
/**
* We calculate the input value of give form inputs and change the redirect url afterwards
*
* @param array $form, array $lead
*
* @return array $confirmation[ 'redirect' ]
**/
add_filter( 'gform_confirmation', 'custom_confirmation', 10, 4 );
You can’t perform that action at this time.