• Hi there, I would prefer to use the PHP method for showing messages in my menu, but my php skills are limited. What does this mean?

    Change theme_location, text as you require.

    Would you please guide me, how and where to put in the navigation label to my page containing the Front End PM short code? Other things to change in the code snippet?

    Thanks

    Carsten

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Shamim Hasan

    (@shamim51)

    You can add that code as it is. If it do not work then you will need to change widget location. You can contact your theme what are the widget location they support. change primary to any one of them.

    Thread Starter Carsten Lund

    (@carsten-lund)

    Thanks, I now realize that the reason why it might not work, is because I use a nav menu widget from Elementor in the header, not the theme menu.

    Thread Starter Carsten Lund

    (@carsten-lund)

    Is it possible to add a widget location which is not defined by the theme, but Elementor?

    I have changed the location to ‘header’ where the nav menu widget is, but no luck.

    Plugin Author Shamim Hasan

    (@shamim51)

    Normally theme follow https://codex.ww.wp.xz.cn/Widgetizing_Themes to add widget location. If Elementor follow same procedure then that will work, otherwise you will have to follow another method or code yourself.

    Thread Starter Carsten Lund

    (@carsten-lund)

    Hi there

    Show unread message count in menu

    Adding this code as it is in functions.php, generates an HTTP ERROR 500?

    add_filter( 'wp_nav_menu_items', 'fep_cus_add_menu_link', 10, 2 );
    
    function fep_cus_add_menu_link( $items, $args ) {
        if ( $args->theme_location == 'primary' ) {
            $items .= '<li><a href="'. fep_query_url( 'messagebox' ) .'">' . sprintf(__('Message Box%s', 'front-end-pm'), fep_get_new_message_button() ) . '</a></li>';
        }
        return $items;
    }

    Regards
    Carsten

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Show unread message count in menu PHP method’ is closed to new replies.