Skip to content

Instantly share code, notes, and snippets.

View media317's full-sized avatar

Alan Smith media317

View GitHub Profile
@media317
media317 / Sortby-Date
Created October 17, 2013 02:01
Sort order by date.
/* My metabox array */
array(
'name' => 'Start Date',
'desc' => 'Project Start Date',
'id' => 'startdate',
'type' => 'text_date',
),
/* My query function */
function mmi_projects_loop () {
@media317
media317 / CPT Genesis
Created September 27, 2013 13:40
How to pull the first term ...
array(
'name' => 'Project Type',
'desc' => 'Select all that apply to this project',
'id' => 'project_type',
'type' => 'multicheck',
'options' => array(
'admin' => 'Administration',
),
),
@media317
media317 / mmi.style.css
Created September 20, 2013 20:28
Stylesheet for Medical Ministry International
/*
Theme Name: Medical Ministry Child Theme
Theme URI: http://medicalministrytrips.org
Description: Medical Ministry Child theme is a two or three column child theme created for the Genesis Framework.
Author: Media317
Author URI: http://media317.net
Version: 2.0
Tags: blue, gray, white, one-column, two-columns, three-columns, left-sidebar, right-sidebar, fixed-width, custom-background, custom-header, custom-menu, full-width-template, sticky-post, theme-options, threaded-comments
@media317
media317 / responsive video div
Created September 18, 2013 23:39
Create a Responsive video player div
#mediaspace_wrapper {
position: relative;
height: 0;
padding-bottom: 59%;
padding-top: 0;
}
/** Add Project Information After Content */
add_action ( 'genesis_sidebar', 'mmi_sing_project_side' );
function mmi_sing_project_side() {
global $wp_query;
$participants = $wp_query->post->ID;
echo '<div class="mmi-sidebar">';
echo '<section class="widget">';
echo '<h4 class="widgettitle">Participate In This Project</h4>';
/** Add new image sizes */
// ( 'name', width, height, crop)
add_image_size( 'Featured', 1040, 400, TRUE );
@media317
media317 / WP Image Size to Media Selection
Last active December 17, 2015 11:38
Add Image Sizes to Media Selection
//** Add image sizes to Media Selection */
add_filter('image_size_names_choose', 'me_display_image_size_names_muploader', 11, 1);
function me_display_image_size_names_muploader( $sizes ) {
$new_sizes = array();
$added_sizes = get_intermediate_image_sizes();
// $added_sizes is an indexed array, therefore need to convert it
// to associative array, using $value for $key and $value
I cannot seem to get this to work... I'm on Genesis 1.9.2
My CPT Projects has several metaboxes. I have four image/file upload metaboxes. I am using the following for the boxes:
array(
'name' => 'Main Project Image',
'desc' => 'Upload an image or enter an URL for the Main Image',
'id' => $prefix . '_main_project_img',
'type' => 'file',
'save_id' => true, // save ID using true
<?php
/**
* The custom Projects post type single post template
*/
/** Remove standard Genesis Loop */
remove_action( 'genesis_loop' , 'genesis_do_loop' );
/** Add custom loop for Portfolio page */
add_action( 'genesis_loop', 'me_portfolio' );
@media317
media317 / gist:5085350
Last active December 14, 2015 12:18
Add custom Avatar to WordPress install.
// Add a default avatar to Settings > Discussion
if ( !function_exists('media317_addgravatar') ) {
function media317_addgravatar( $avatar_defaults ) {
$myavatar = get_bloginfo('stylesheet_directory') . '/images/avatar.jpg'; // Make sure to add the images directory to theme
$avatar_defaults[$myavatar] = 'Media317'; //Add a default name for the Avatar
return $avatar_defaults;
}
add_filter( 'avatar_defaults', 'fb_addgravatar' );