Viewing 17 posts - 1 through 17 (of 17 total)
  • Author
    Posts
  • #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” ?
    Thanks

    #417211

    Hi tech500!

    Please go to Enfold/includes/admin and open register-portfolio.php file and search “Portfolio Items” and replace it with “Artist Work”

    Cheers!
    Yigit

    #417216

    Hi Yigit,

    But these changes would lost once the theme is updated.
    How can I make it permanent ?
    Using child theme ? How ?

    Thanks

    Dan

    #417619

    Hey!

    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,
    Ismael

    #650335

    Is it possible to change the “Portfolio Categories” name as well?

    #651223

    Hi,

    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,
    Ismael

    #676004

    This 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?

    #677389

    Hi,

    Edit the includes > admin > register-portfolio.php file directly.

    Best regards,
    Ismael

    #677700

    I 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”.

    #679259

    Hi,

    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,
    Ismael

    #1239703
    This reply has been marked as private.
    #1240023

    Hi Dino0103,

    You can change the portfolio permalinks under Settings->Permalinks in the WordPress menu.

    Best regards,
    Rikard

    #1428990

    Hello 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

    #1428993

    It’s been too long since I’ve worked on that problem. But I think I might have resolved it using the Toolset Types plugin.

    #1429033

    Hi,
    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:
    Enfold_Support_4262.jpeg
    then the database will be updated:
    Enfold_Support_4264.jpeg
    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,
    Mike

    #1429201

    Hi 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

    #1429255

    Hi,
    If you edit the register-portfolio.php file it will be overwritten with each update, so you will need to make this edit everytime, but you will not also need to add the code that we posted. You can do one or the other.

    Best regards,
    Mike

Viewing 17 posts - 1 through 17 (of 17 total)
  • You must be logged in to reply to this topic.