Skip to content

Instantly share code, notes, and snippets.

@damiencarbery
Last active August 26, 2019 20:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save damiencarbery/48f260f0f91ac81da6895f9d711fdb35 to your computer and use it in GitHub Desktop.
Save damiencarbery/48f260f0f91ac81da6895f9d711fdb35 to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: Change Genesis Portfolio Pro settings
Plugin URI: https://www.damiencarbery.com
Description: Change the settings for the Genesis Portfolio Pro CPT.
Author: Damien Carbery
Version: 0.1
*/
add_filter( 'register_post_type_args', 'dcwd_change_cpt_args', 10, 2 );
function dcwd_change_cpt_args( $args, $cpt_name ) {
//error_log( "CPT Name: $cpt_name" );
if ( 'portfolio' == $cpt_name ) {
//error_log( $cpt_name . ': ' . var_export( $args, true ) );
$args['labels']['name'] = 'Case Studies';
$args['labels']['menu_name'] = 'Case Studies';
$args['labels']['add_new'] = 'Add New Case Study';
$args['labels']['add_new_item'] = 'Add New Case Study';
$args['labels']['edit_item'] = 'Edit Case Study';
$args['labels']['all_items'] = 'All Case Studies';
$args['rewrite'] = array(
'slug' => 'case-studies',
'with_front' => false,
);
//error_log( $cpt_name . ': ' . var_export( $args, true ) );
}
return $args;
}
portfolio: array (
'labels' =>
array (
'name' => 'Portfolio Items',
'singular_name' => 'Portfolio Item',
'menu_name' => 'Portfolio Items',
'name_admin_bar' => 'Portfolio Item',
'add_new' => 'Add New',
'add_new_item' => 'Add New Portfolio Item',
'new_item' => 'New Portfolio Item',
'edit_item' => 'Edit Portfolio Item',
'view_item' => 'View Portfolio Item',
'all_items' => 'All Portfolio Items',
'search_items' => 'Search Portfolio Items',
'parent_item_colon' => 'Parent Portfolio Items:',
'not_found' => 'No Portfolio Items found.',
'not_found_in_trash' => 'No Portfolio Items found in Trash.',
),
'has_archive' => true,
'hierarchical' => true,
'menu_icon' => 'dashicons-format-gallery',
'public' => true,
'rewrite' =>
array (
'slug' => 'portfolio',
'with_front' => false,
),
'supports' =>
array (
0 => 'title',
1 => 'editor',
2 => 'author',
3 => 'thumbnail',
4 => 'excerpt',
5 => 'trackbacks',
6 => 'custom-fields',
7 => 'revisions',
8 => 'page-attributes',
9 => 'genesis-seo',
10 => 'genesis-cpt-archives-settings',
),
'taxonomies' =>
array (
0 => 'portfolio-type',
),
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment