Skip to content

Instantly share code, notes, and snippets.

View webmasterninjay's full-sized avatar
💭
I may be slow to respond.

Jay webmasterninjay

💭
I may be slow to respond.
View GitHub Profile
@webmasterninjay
webmasterninjay / menu.css
Created March 7, 2015 13:02
Genesis Responsive Menu (CSS)
/* Responsive Navigation
---------------------------------------------------------------------------------------------------- */
/* Standard Navigation
--------------------------------------------- */
nav {
clear: both;
}
@webmasterninjay
webmasterninjay / jay-custom-widget-class.php
Created March 20, 2015 11:33
Wordpress: Adding custom classes on widget
<?php
function jay_widget_form_extend( $instance, $widget ) {
if ( !isset($instance['classes']) )
$instance['classes'] = null;
$row = "<p>";
$row .= "<label for='widget-{$widget->id_base}-{$widget->number}-classes'>Additional Classes <small>(separate with spaces)</small></label>";
$row .= "<input type='text' name='widget-{$widget->id_base}[{$widget->number}][classes]' id='widget-{$widget->id_base}-{$widget->number}-classes' class='widefat' value='{$instance['classes']}'/>";
$row .= "</p>";
@webmasterninjay
webmasterninjay / custom-loop.php
Created March 20, 2015 11:40
Wrdpress: WP Query shortcode
<?php
/*
* Call using [jay-home-recent/] shortcode
*/
// Home recent shortcode
add_shortcode( 'jay-home-recent', 'jay_post_listing_shortcode' );
function jay_post_listing_shortcode($atts) {
@webmasterninjay
webmasterninjay / genesis-child-option.php
Created March 28, 2015 18:51
Wordpress: Genesis Child Theme Option Framework
<?php
define('COMPASSIONATE_SETTINGS_FIELD','compassionate-settings');
class COMPASSIONATE_THEME_SETTINGS extends Genesis_Admin_Boxes {
function __construct() {
$page_id = 'compassionate';
@webmasterninjay
webmasterninjay / remove-autop.php
Created March 29, 2015 20:40
Wordpress: Remove auto p filter on custom post type
<?php
add_filter( 'the_content', 'jay_remove_autop', 0 );
function jay_remove_autop( $content ) {
// change 'post-type' to the custom post type
'post-type' === get_post_type() && remove_filter( 'the_content', 'wpautop' );
return $content;
<?php
add_filter('post_class', 'jay_grid_view_post_class');
function jay_grid_view_post_class( $classes ) {
if( is_post_type_archive( $posttype ) ):
$columns = 3;
$classes[] = 'one-third';
global $wp_query;
if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % $columns )
$classes[] = 'first';
@webmasterninjay
webmasterninjay / cpt-setting.php
Created March 31, 2015 18:13
Genesis Theme: Use different image size in CPT Archive page
<?php
function food_recipe_image_size( $image_size ) {
// Only run on the 'image' post type archive
if( is_post_type_archive( $posttype ) )
$image_size = 'recipe-thumbs';
return $image_size;
@webmasterninjay
webmasterninjay / funtions.php
Created March 31, 2015 18:41
Genesis Theme: Move post image above post title
<?php
// Move post image above post title
remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
add_action( 'genesis_entry_header', 'genesis_do_post_image', 3 );
@webmasterninjay
webmasterninjay / functions.php
Created March 31, 2015 18:42
Genesis Theme: Edit read more link on cpt archive
<?php
// Edit read more link on certain cpt archive
add_filter( 'get_the_content_more_link', 'chloe_read_more_link' );
function chloe_read_more_link() {
if ( is_post_type_archive( 'food-recipes' ) ) {
return '<p class="text-center"><a class="button get-recipe" href="' . get_permalink() . '">Get The Recipe Here</a></p>';
}
@webmasterninjay
webmasterninjay / functions.php
Created March 31, 2015 18:42
Genesis Theme: Remove Post Info, Post Meta from Food Recipes Archive Page
<?php
// Remove Post Info, Post Meta from Food Recipes Archive Page
function chloe_remove_post_meta() {
if( is_post_type_archive( 'food-recipes' ) ) {
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
}
}
add_action ( 'genesis_entry_header', 'chloe_remove_post_meta' );