php - How to change href of a Widget menu item link?

I assume that using a filter would be the best way to do this, but I am not so familiar with php code so I require someo

I assume that using a filter would be the best way to do this, but I am not so familiar with php code so I require someones masterful input please!

Here is the widgets menu:

This widget comes with the theme that I am using, which does not allow me to manually edit the links. I would like to overwrite the destination of these menu items with a custom link.

If it is at all useful, the widget is called: Thim-login, and the list of items are contained within this class: .widget.widget_thim-login

Here is also some sample html of the widget:

<div class="widget widget_thim-login"><a href="LINK" class="user-name"><span class="author"></span><img alt="" src="GRAVATAR-LINK" srcset="GRAVATAR-LINK" class="avatar avatar-45 photo" height="45" width="45"></a><ul class="user-info"><li class="menu-item menu-item-courses"><a href="LINK">My Courses</a></li></ul></div>

Many thanks! - D

EDIT: Perhaps I can adapt this code to also over-ride the links? ...

    add_filter( 'thim_header_user_dropdown_content', 'handle_menu_dropdown_profile' );
if ( ! function_exists( 'handle_menu_dropdown_profile' ) ) {
    function handle_menu_dropdown_profile( $dropdown_content_args ) {
        if ( isset( $dropdown_content_args['become_a_teacher'] ) ) {
            /*$dropdown_content_args = array(
                'become_a_teacher' => esc_html__( 'Become An Instructor', 'course-builder' ),
                'courses'          => esc_html__( 'My Courses', 'course-builder' ),
                'orders'           => esc_html__( 'My Orders', 'course-builder' ),
                'certificates'     => esc_html__( 'My Certificates', 'course-builder' ),
                'settings'         => esc_html__( 'Edit Profile', 'course-builder' ),
            );*/
            $dropdown_content_args['settings'] = esc_attr__( 'My Profile', 'course-builder' );

            return $dropdown_content_args;
        }
    }
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745306394a4621734.html

相关推荐

  • php - How to change href of a Widget menu item link?

    I assume that using a filter would be the best way to do this, but I am not so familiar with php code so I require someo

    13小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信