-
AuthorPosts
-
November 4, 2014 at 8:44 pm #346091
Hello, I am trying to enable the Author selection dropdown within the portfolio entries.
I’ve come across this: http://codex.wordpress.org/Function_Reference/register_post_type
Which suggests I need to add: ‘author’ within the portfolio custom post type registration. I did this on file: /enfold/includes/admin/register-portfolio.php but it did not seem to have any effect in the admin area as I have no author option there.
Also ideally I would like to implement this in a way that allows me to preserve changes, so would love for a way to do this within my child theme.
Thanks!
November 5, 2014 at 1:53 am #346306Hi momon!
I’m not sure if this edit would be feasible in a child theme but you can do this by opening up /enfold/includes/admin/register-portfolio.php and changing line 38 from this,
'supports' => array('title','thumbnail','excerpt','editor','comments')
To this,
'supports' => array('title','thumbnail','excerpt','editor','comments', 'author')
EDIT:
You can try adding this to your child theme’s functions.php file but I’m not sure if this is safe or not so I would wait for another member of our team to check and see if there is a better way.
add_action('init', 'customization_portfolio_register'); function customization_portfolio_register() { global $avia_config; $labels = array( 'name' => _x('Portfolio Items', 'post type general name','avia_framework'), 'singular_name' => _x('Portfolio Entry', 'post type singular name','avia_framework'), 'add_new' => _x('Add New', 'portfolio','avia_framework'), 'add_new_item' => __('Add New Portfolio Entry','avia_framework'), 'edit_item' => __('Edit Portfolio Entry','avia_framework'), 'new_item' => __('New Portfolio Entry','avia_framework'), 'view_item' => __('View Portfolio Entry','avia_framework'), 'search_items' => __('Search Portfolio Entries','avia_framework'), 'not_found' => __('No Portfolio Entries found','avia_framework'), 'not_found_in_trash' => __('No Portfolio Entries found in Trash','avia_framework'), 'parent_item_colon' => '' ); $permalinks = get_option('avia_permalink_settings'); if(!$permalinks) $permalinks = array(); $permalinks['portfolio_permalink_base'] = empty($permalinks['portfolio_permalink_base']) ? __('portfolio-item', 'avia_framework') : $permalinks['portfolio_permalink_base']; $permalinks['portfolio_entries_taxonomy_base'] = empty($permalinks['portfolio_entries_taxonomy_base']) ? __('portfolio_entries', 'avia_framework') : $permalinks['portfolio_entries_taxonomy_base']; $args = array( 'labels' => $labels, 'public' => true, 'show_ui' => true, 'capability_type' => 'post', 'hierarchical' => false, 'rewrite' => array('slug'=>_x($permalinks['portfolio_permalink_base'],'URL slug','avia_framework'), 'with_front'=>true), 'query_var' => true, 'show_in_nav_menus'=> true, 'taxonomies' => array('post_tag'), 'supports' => array('title','thumbnail','excerpt','editor','comments', 'author') ); $args = apply_filters('avf_portfolio_cpt_args', $args); $avia_config['custom_post']['portfolio']['args'] = $args; register_post_type( 'portfolio' , $args ); $tax_args = array( "hierarchical" => true, "label" => "Portfolio Categories", "singular_label" => "Portfolio Category", "rewrite" => array('slug'=>_x($permalinks['portfolio_entries_taxonomy_base'],'URL slug','avia_framework'), 'with_front'=>true), "query_var" => true, "supports" => array('title', 'editor', 'author' ) ); $avia_config['custom_taxonomy']['portfolio']['portfolio_entries']['args'] = $tax_args; register_taxonomy("portfolio_entries", array("portfolio"), $tax_args); //deactivate the avia_flush_rewrites() function - not required because we rely on the default wordpress permalink settings remove_action('wp_loaded', 'avia_flush_rewrites'); }
Cheers!
Elliott- This reply was modified 10 years ago by Elliott.
November 5, 2014 at 3:06 am #346323Thanks elliot, I had tried doing this before:
‘supports’ => array(‘title’,’thumbnail’,’excerpt’,’editor’,’comments’, ‘author’)
I did it on the main theme and there was still no author box present on my portfolio items.
Thanks.
November 5, 2014 at 4:28 am #346336Hey!
I tested the suggested modification and it worked on my install, make sure you have the Author box selected here – http://screencast.com/t/QtJY7lPwa
Regards,
JosueNovember 5, 2014 at 4:59 am #346356Thank you, I figured it out.
The problem was that I already had a function on my child theme that was taking precedence over the main theme file, so my changes on the main theme file where being ignored.
Instead of adding ‘author’ on the main theme file I did it on my child theme’s function.php like this:
add_filter('avf_portfolio_cpt_args', 'avf_portfolio_add_cpt_args', 1); function avf_portfolio_add_cpt_args($args) { $args['hierarchical'] = true; $args['supports'] = array('title','thumbnail','excerpt','editor','comments', 'page-attributes','author'); return $args; }
This worked as expected.
Thanks.
November 5, 2014 at 5:03 am #346358D’oh, i totally missed that filter, glad you figured it out :)
Best regards,
Josue -
AuthorPosts
- The topic ‘Portfolio Items Author’ is closed to new replies.