CodeFlavors on "[Plugin: FA Lite - WP responsive slider plugin] How to change plugin admin menu label?"

ساخت وبلاگ

Salpetriere
Member
Posted 2 weeks ago #

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 ); retu $menu;
}

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

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 * @retu array */
function rename_fa_lite_menu( $args, $post_type ){ global $fa_lite; if( !$fa_lite || !is_admin() ){ retu $args; } $slider_pt = $fa_lite->post_type_slider(); if( $slider_pt == $post_type ){ $args['labels']['menu_name'] = __( 'Front page slider' ); } retu $args;
}
add_filter( 'register_post_type_args', 'rename_fa_lite_menu', 999, 2 );

Salpetriere
Member
Posted 2 weeks ago #

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.

Hi,

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

Salpetriere
Member
Posted 2 weeks ago #

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

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.

Salpetriere
Member
Posted 1 week ago #

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.

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/

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 132 تاريخ : شنبه 18 ارديبهشت 1395 ساعت: 13:24