admin管理员组

文章数量:1125794

I created my own custom theme with wordpress and now I want to add english language to my site (defualt is persian rtl). for this I installed polylang. I create menu in wordpress like this:

functuions.php:

<?php
//Add Custom classes to the a tag of menu
function add_menu_link_class($atts, $item, $args)
{
    if (isset($args->a_class)) {
        $atts['class'] = $args->a_class;
    }
    return $atts;
}
add_filter('nav_menu_link_attributes', 'add_menu_link_class', 1, 3);

and for showing the menu I coded in header.php:

wp_nav_menu(array(
            'theme_location' => 'top',
            'container_id' => 'main-menu',
            'container_class' => 'collapse navbar-collapse mt-lg-0 mt-3 ms-lg-5',
            'menu_class' => 'navbar-nav me-auto mb-2 mb-lg-0',
            'a_class' => 'nav-link mx-lg-3 p-lg-0 px-lg-0 px-3s'
          ));

before I installed the polyland all classes added to the menu tags perfectly. but when the plugin installed all custom tags are cleared. how can I fix this issue?

Also any other tips that can get to make this plugin compatible with my theme would be appreciated.

本文标签: phpmake my custom theme support polylang plugin