Skip to content

Instantly share code, notes, and snippets.

View jamieschmid's full-sized avatar

Jamie Schmid jamieschmid

  • Portland, OR
View GitHub Profile
@jamieschmid
jamieschmid / gist:af321397f7966f791aab92637729cace
Created July 27, 2023 12:11
WordPress soft crop function using intermediate_image_sizes_advanced()
function soft_crop( $sizes ) {
$sizes['medium'] = array(
'width' => 300,
'height' => 0,
'crop' => true,
);
return $sizes;
}
add_filter( 'intermediate_image_sizes_advanced', 'soft_crop' );
@jamieschmid
jamieschmid / functions.php
Last active December 21, 2019 16:28
WordPress block template function with ACF and Gravity Forms blocks
/**
* Adds block template to single custom post type Careers posts.
*/
function careers_block_template() {
$post_type_object = get_post_type_object( 'careers' );
$post_type_object->template = array(
array( 'acf/job-location' ),
array( 'acf/job-description' ),
array( 'acf/job-role' ),
@jamieschmid
jamieschmid / gist:c83d3c39316ace7a88b7
Last active December 14, 2015 20:04
Change Projects Custom Post Type name in Divi, still works with Portfolio
$singular_name = 'Book'; // Enter the singular name for your new post type within the quotes
$plural_name = 'Books'; // Enter the plural name of your new post type within the quotes
function divi_projects_rename() {
global $wp_post_types;
global $singular_name;
global $plural_name;
$labels = $wp_post_types['project']->labels;
@jamieschmid
jamieschmid / Add & Customize Options Page
Last active August 29, 2015 14:24
Advanced Custom Fields gists
if( function_exists('acf_add_options_page') ) {
$page = array(
'page_title' => 'Header',
'menu_title' => 'Header',
'menu_slug' => 'header',
'capability' => 'edit_posts',
'redirect' => false,
'position' => '3.3'
);