Tagged: change, Name, portfolio items, post type
-
AuthorPosts
-
March 24, 2015 at 9:39 am #416956
Hello,
In Enfold Admin there is the “Portfolio Items” post-type section.
What is the best way to change the name for example from “Portfolio Items” to “Artist Work” ?
ThanksMarch 24, 2015 at 5:38 pm #417211Hi tech500!
Please go to Enfold/includes/admin and open register-portfolio.php file and search “Portfolio Items” and replace it with “Artist Work”
Cheers!
YigitMarch 24, 2015 at 5:40 pm #417216Hi Yigit,
But these changes would lost once the theme is updated.
How can I make it permanent ?
Using child theme ? How ?Thanks
Dan
March 25, 2015 at 9:25 am #417619Hey!
Remove the mod then add this to the functions.php file:
add_filter('avf_portfolio_cpt_args', 'avf_portfolio_cpt_args_mod'); function avf_portfolio_cpt_args_mod($args) { $args['labels']['name'] = 'Artist Work'; return $args; }
Regards,
IsmaelJune 19, 2016 at 5:46 am #650335Is it possible to change the “Portfolio Categories” name as well?
June 21, 2016 at 4:39 am #651223Hi,
Try this in the functions.php file:
add_action('init', 'portfolio_reregister', 50); function portfolio_reregister() { global $avia_config; $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']; $tax_args = array( "hierarchical" => true, "label" => "Artist Work", "singular_label" => "Portfolio Category", "rewrite" => array('slug'=>_x($permalinks['portfolio_entries_taxonomy_base'],'URL slug','avia_framework'), 'with_front'=>true), "query_var" => true ); $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'); }
Best regards,
IsmaelAugust 22, 2016 at 8:06 pm #676004This is great. Thanks for providing this. Although it does change the naming in the Dashboard sidebar, it’s not changing the name site-wise. The individual other areas where the names “Portfolio Entry” remains the same (top black bar navigation drop down: “add”, and the single post/entry.
Can this be done?
August 25, 2016 at 8:06 am #677389Hi,
Edit the includes > admin > register-portfolio.php file directly.
Best regards,
IsmaelAugust 25, 2016 at 6:13 pm #677700I had seen that recommended fix at the top of this thread. But, when the fix is applied in: enfold-child >includes >admin >register-portfolio.php, it does not work. It does, however, work in the parent theme. And, that would be a problem on future updates.
Also (for those following this thread), there are 2 terms to find/replace with the preferred: “Portfolio Items” and “Portfolio Entry”.
August 30, 2016 at 4:59 am #679259Hi,
Yes, unfortunately, you can’t override the file in a child theme. However, you can try this in the functions.php file:
add_action('after_setup_theme', function() { remove_action('init', 'portfolio_register'); }); add_action('init', 'portfolio_register_mod'); function portfolio_register_mod() { global $avia_config; $labels = array( 'name' => _x('Change This Change This', 'post type general name','avia_framework'), 'singular_name' => _x('Change This', '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') ); $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 ); $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'); }
Best regards,
IsmaelAugust 21, 2020 at 4:12 am #1239703This reply has been marked as private.August 23, 2020 at 4:18 am #1240023Hi Dino0103,
You can change the portfolio permalinks under Settings->Permalinks in the WordPress menu.
Best regards,
RikardDecember 29, 2023 at 10:54 am #1428990Hello there…
I can see this is quite an old thread but it’s the only one that relates to what I’m doing (as far as I can see).
I’ve performed the actions in the first comment by Yigit and that worked fine. Then I tried the permanent method below it but that does not work (for me anyway). I’m useless at code just about managed to copy and paste chunks or make small changes… I almost always use the visual editor.
Perhaps somebody could tell me where to place a piece of custom code to make this a permanent fix for me? I’m trying to change the Perma link from ‘portfolio-items’ to ‘sites’ as seen here:
ttw.org.uk/sites
In the meantime I will keep the temporary fix in place
Sincerely
Philip
December 29, 2023 at 12:06 pm #1428993It’s been too long since I’ve worked on that problem. But I think I might have resolved it using the Toolset Types plugin.
December 30, 2023 at 4:20 pm #1429033Hi,
The code Ismael posted above worked for me changing the backend “portfolio” labels to “sites” after I adjusted it some:add_action('after_setup_theme', function() { remove_action('init', 'portfolio_register'); }); add_action('init', 'portfolio_register_mod'); function portfolio_register_mod() { global $avia_config; $labels = array( 'name' => _x('sites', 'post type general name','avia_framework'), 'singular_name' => _x('sites', 'post type singular name','avia_framework'), 'add_new' => _x('Add New', 'sites','avia_framework'), 'add_new_item' => __('Add New Sites Entry','avia_framework'), 'edit_item' => __('Edit Sites Entry','avia_framework'), 'new_item' => __('New Sites Entry','avia_framework'), 'view_item' => __('View Sites Entry','avia_framework'), 'search_items' => __('Search Sites Entries','avia_framework'), 'not_found' => __('No Sites Entries found','avia_framework'), 'not_found_in_trash' => __('No Sites 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']) ? __('sites', 'avia_framework') : $permalinks['portfolio_permalink_base']; $permalinks['portfolio_entries_taxonomy_base'] = empty($permalinks['portfolio_entries_taxonomy_base']) ? __('sites_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') ); $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" => "Sites Categories", "singular_label" => "Sites Category", "rewrite" => array('slug'=>_x($permalinks['portfolio_entries_taxonomy_base'],'URL slug','avia_framework'), 'with_front'=>true), "query_var" => true ); $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'); }
but to change the permalinks from ‘portfolio-items’ to ‘sites’ you will need to adjust the permalink field and then resave the permalinks:
then the database will be updated:
You will need to do this because you can not overwrite the register-portfolio.php file in the child theme and the original file still add the portfolio function, otherwise you will have your new CPT and the portfolio CPT both showing in the permalinks options.
Or you can try laptophobo’s plugin option.Best regards,
MikeJanuary 3, 2024 at 6:47 pm #1429201Hi Mike,
Thank you so much for taking the time to send a detailed response…
I’ve just checked the settings and I can see that the permalink has been changed in the settings presumably because of the temporary fix I made in register-portfolio.php file as mentioned at the top of this thread. And I’m presuming that this will be over written when the theme is updated.
I also noticed that Rikard said back in August 23 2020 “You can change the portfolio permalinks under Settings->Permalinks in the WordPress menu”
So I’m going to ask what is probably a daft question… Do I still need to copy and paste all of the code into functions.php file?
I’m very much in front end user as you can tell so forgive my ignorance
Sincerely
Philip
January 4, 2024 at 11:32 am #1429255 -
AuthorPosts
- You must be logged in to reply to this topic.