Skip to content

Instantly share code, notes, and snippets.

View geeac's full-sized avatar

Eugenia Cosinschi geeac

View GitHub Profile
@geeac
geeac / footer-credits.php
Created January 19, 2017 10:01
genesis change footer credits
@geeac
geeac / replace-image-shortcode.php
Created December 6, 2016 08:07
replace image on load and resize
//* Shortcode to print a responsive image
//* Example shortcode: [responsive-image url=http://info-graphic.ca/wp-content/uploads/2016/11/graph2-s.jpg]
add_shortcode('responsive-image','func_responsive_image');
function func_responsive_image($atts) {
if(isset($atts['url'])):
$image_url = $atts['url'];
else:
echo 'Image not specified';
endif;
@geeac
geeac / image_sizes.php
Created December 5, 2016 09:47
change img srcset
/*function adjust_image_sizes_attr( $sizes, $size ) {
$sizes = '(max-width: 300px) 300px, (max-width: 768px) 768px, (max-width: 1024px) 1024px, (max-width: 1500px) 1500px, 1024px';
return $sizes;
}
add_filter( 'wp_calculate_image_sizes', 'adjust_image_sizes_attr', 10 , 2 );*/
//* Add custom images instead of default resized from srcset
//add_filter( 'wp_calculate_image_srcset', 'ig_add_custom_image_srcset', 10, 5 );
function ig_add_custom_image_srcset( $sources, $size_array, $image_src, $image_meta, $attachment_id ){
@geeac
geeac / functions.php
Created October 15, 2016 08:21 — forked from eugenoprea/functions.php
Genesis Previous/Next Post Post Navigation
/** Genesis Previous/Next Post Post Navigation */
add_action( 'genesis_before_comments', 'eo_prev_next_post_nav' );
function eo_prev_next_post_nav() {
if ( is_single() ) {
echo '<div class="prev-next-navigation">';
previous_post_link( '<div class="previous">Previous article: %link</div>', '%title' );
@geeac
geeac / genesis_feat_image_bg_blog.php
Last active February 25, 2018 13:24
Genesis - Add Featured Image on top of pages and posts
// Add Featured Image on top of pages as background image
add_action( 'genesis_after_header', 'featured_page_image', 11 );
function featured_page_image() {
if ( !is_singular('page') && !is_home() ) return;
if (is_home()){
// Get the ID of your posts page
$id = get_option('page_for_posts');
// Use the ID to get the post thumbnail or whatever
if ( has_post_thumbnail( $id ) ) {
//echo get_the_post_thumbnail( $id, 'page-featured', array( 'class' => 'aligncenter page-featured' ) );
@geeac
geeac / genesis_primary_nav.php
Created May 20, 2016 07:23
Genesis Add search form to primary navigation
//* Add search form to navigation
/*add_filter( 'wp_nav_menu_items', 'market_primary_nav_extras', 10, 2 );
function market_primary_nav_extras( $menu, $args ) {
if ( 'primary' !== $args->theme_location ) {
return $menu;
}
ob_start();
get_search_form();
$search = ob_get_clean();
@geeac
geeac / ninja-forms-add-email-attachment.php
Created February 21, 2016 12:55 — forked from kjohnson/ninja-forms-add-email-attachment.php
Add an Attachment to Email Notifications in Ninja Forms
<?php
/*
Plugin Name: Ninja Forms Email Attachment
*/
function add_my_attachment( $attachments ) {
$attachments[] = 'server_path_to_my_file';
return $attachments;
}
@geeac
geeac / gist:b4884df26e0269490647
Created February 19, 2016 12:00 — forked from zachskaggs/gist:469935ff6c0847494402
Ninja Forms Timestamp
<?php
/*
Plugin Name: Example Plugin
*/
<?php
function my_ninja_forms_date_code(){
//Declare $ninja_forms_processing as a global variable.
global $ninja_forms_processing;
//only process this code on the form ID 1
$form_id = $ninja_forms_processing->get_form_ID();
@geeac
geeac / provision-post.sh
Created October 11, 2015 08:01 — forked from aaroneaton/provision-post.sh
Setup themes & plugins after VVV provision
# Get rid of the default crap
wp site empty --yes
# Remove Hello Dolly (sorry Matt)
wp plugin uninstall hello
# Install Genesis framework
wp theme install <super-secret-url-for-genesis>
# Install plugins available in repo
@geeac
geeac / functions.php
Last active September 17, 2015 08:03 — forked from srikat/functions.php
How to add Beautiful Pro’s mobile responsive menu in other Genesis themes. http://sridharkatakam.com/add-beautiful-pros-mobile-responsive-menu-genesis-themes/
// Enqueue scripts and styles
add_action( 'wp_enqueue_scripts', 'custom_scripts_styles_mobile_responsive' );
function custom_scripts_styles_mobile_responsive() {
wp_enqueue_script( 'beautiful-responsive-menu', get_stylesheet_directory_uri() . '/js/responsive-menu.js', array( 'jquery' ), '1.0.0' );
wp_enqueue_style( 'dashicons' );
}