Support » Plugin: FA Lite - WP responsive slider plugin » How to change plugin admin menu label?

  • Resolved Salpetriere

    (@salpetriere)



    Do you have anything that I can hook into in order to change the admin menu text that you’ve used for the plugin?

    The current text, ‘FA Lite 3’, is not going to be usable for my client. When they see that in the admin menu they’re not going have any idea what that menu item actually refers to.

    In the best interests of my client it needs to be changed to something like ‘Front Page Slider’.

    I’ve tried the following string replace method but it doesn’t work.

    add_filter('gettext', 'rename_admin_menu_items');
    add_filter('ngettext', 'rename_admin_menu_items');
    function rename_admin_menu_items( $menu ) {
    	$menu = str_ireplace( 'FA Lite 3', 'Front Page Slider', $menu );
    	return $menu;
    }

    https://wordpress.org/plugins/featured-articles-lite/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author CodeFlavors

    (@codeflavors)

    I’m sorry but currently there’s no plugin hook that can help you achieve this. You can use the following code into your theme functions.php though:

    /**
     * Rename FA Lite menu from FA Lite 3 to something else
     *
     * @param array $args - post type details
     * @param string $post_type - post type name
     * @return array
     */
    function rename_fa_lite_menu( $args, $post_type ){
    	global $fa_lite;
    	if( !$fa_lite || !is_admin() ){
    		return $args;
    	}
    
    	$slider_pt = $fa_lite->post_type_slider();
    	if( $slider_pt == $post_type ){
    		$args['labels']['menu_name'] = __( 'Front page slider' );
    	}
    
    	return $args;
    }
    add_filter( 'register_post_type_args', 'rename_fa_lite_menu', 999, 2 );

    Many thanks for your prompt reply.

    Did you test the provided code?

    I’ve added it to my child themes functions.php file but it’s not working.

    Plugin Author CodeFlavors

    (@codeflavors)

    Hi,

    Yes, I tested it in a child theme and it modified the output (WP 4.5, theme Twenty Fifteen).

    I’m using WordPress version 4.5 with the Twenty Sixteen theme and it’s not working.

    Plugin Author CodeFlavors

    (@codeflavors)

    Hi,

    Pasted the exact same code from above into with Twenty Sixteen functions.php and it worked. Can’t say what could be happening on your installation that prevents this from working.

    Did you try it from a child theme functions.php or the actual Twenty Sixteen parent theme itself?

    As mentioned, this isn’t working for me in a child theme.

    Plugin Author CodeFlavors

    (@codeflavors)

    Hi,

    Sorry for the delay. Yes, I tried from theme directly and from child theme. If you can allow me temporary FTP and WP admin access to take a look, please contact us here: http://codeflavors.com/contact/

    No problems, the details have now been sent.

    Plugin Author Constantin Boiangiu

    (@constantinboiangiu)

    Thank you , problem solved. I e-mailed you back with more details.

    Note: for others trying to do this, please make sure you use plugin version 3.1.3+

    Many thanks Constantin.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘How to change plugin admin menu label?’ is closed to new replies.