7 – How do you provide a change in a main menu?

We have a small D7 page. We want to disable a main menu item.
On the Dev server I could disable it in / admin / structure / menu / manage / main-menu

I think the menu is stored in the DB, right. Also in a configuration file? So you just have to provide these two things and it's done.

Is that correct? If not, what are the steps to provide a main menu change?

Problem with new topic in faulty menu order and in faulty information on the main page (the higher-level page settings are correct, but the menu order is incorrect)

We are entrepreneurs in incubator Growth Entrepreneur. Currently, the Expert Center supports me with troubleshooting the website. With his limited username and password for the WP site, he has granted me access to the site's settings.

The page before changing the menus can be seen here:


and :

Enter image description here
The elders are here:

Enter image description here

New menus that are confusing due to the installation of new menus can be seen here:

Enter image description here

You can see the site issue below:

Enter image description here

When I talked to the person in charge of the site, he told me that after changing the theme of the site, there was a problem and the menu order was corrupted and the pages too … while the page editing content was in the correct order see here:

Enter image description here

Looks like there is a problem with the menus in the topic, I have manually ordered menu content as you can see here:

Enter image description here

This could be resolved by rearranging menus in the Appearance section. However, there is another problem where the information of the first page is damaged.

I would like to know why this problem has occurred and if logs are required for this question. How can I find these logs with a partially restricted user ID?

Thank you very much

php – Show comment menu in dashboard only if the site contains a comment

I'd like to hide the Comments menu in the Dashboard until the site no longer has any comments. I tried to do this with the following code, but it does not work:

function remove_mainmenu_pages() {
        global $user_ID;
        if ( 1 < wp_count_comments( get_the_ID() )->approved ) {
                remove_menu_page( 'edit-comments.php' );
add_action( 'admin_menu', 'remove_mainmenu_pages' );

Thank you so much!

grub2 – Linux Mint is not displayed in the grub menu

I had Kubuntu installed next to Windows 8. Everything was fine. And I decided to switch from Kubuntu to Linux Mint. So I started Linux Mint to install it. After the installation was complete, I deleted the Kubuntu partition and installed Mint there, restarted the computer, and determined that there is no option to select Linux Mint. Please help. Did I do something wrong during the installation process?

PHP – How do I get the menu class in WordPress?

Thank you for your contribution to StackOverflow in Spanish!

  • Please be sure answer the question, Give information and share your research!

But shun

  • Ask for help or clarification, or respond to other answers.
  • Make statements based on opinions; Make sure you provide them with references or your personal experience.

For more information, see our tips for writing great answers.

python – How do I add a PyQt menu bar to my program?

Hello, I am currently working on a user interface for my Python program with PyQt5 and feel a little lost. I hope you could help me.

In my program, I first read a CSV file and then create a data frame with pandas. That works too.

Now I want to create a user interface with PyQt5. This interface should contain a menu bar with two buttons ("File" and "Run") and display my data frame (see image),

How it should finally look like

With the first button I want to read my csv file and start the program with the other.

Currently I can only display a data frame with my user interface (see image),

What it looks like now

This is currently my code with a random data frame

import sys
import pandas as pd
from PyQt5.QtWidgets import QApplication, QTableView
from PyQt5.QtCore import QAbstractTableModel, Qt

df = pd.DataFrame({'A': ('AAAAAAAA11111111', 'xyz', 'xyz', 'xyz', 'xyz', 'xyz', 'xyz', 'xyz', 'xyz'),
                   'B': ('BBBBBBBB11111111', 'xyz', 'xyz', 'xyz', 'xyz', 'xyz', 'xyz', 'xyz', 'xyz'),
                   'C': ('CCCCCCCC11111111', 'xyz', 'xyz', 'xyz', 'xyz', 'xyz', 'xyz', 'xyz', 'xyz'),        
                   'D': ('CCCCCCCC11111111', 'xyz', 'xyz', 'xyz', 'xyz', 'xyz', 'xyz', 'xyz', 'xyz')})

class pandasModel(QAbstractTableModel):

    def __init__(self, data):
        self._data = data

    def rowCount(self, parent=None):
        return self._data.shape(0)

    def columnCount(self, parent=None):
        return self._data.shape(1)

    def data(self, index, role=Qt.DisplayRole):
        if index.isValid():
            if role == Qt.DisplayRole:
                return str(self._data.iloc(index.row(), index.column()))
        return None

    def headerData(self, col, orientation, role):
        if orientation == Qt.Horizontal and role == Qt.DisplayRole:
            return self._data.columns(col)
        return None

if __name__ == '__main__':
    app = QApplication(sys.argv)
    model = pandasModel(df)
    view = QTableView()
    view.resize(800, 300)

In order to maintain my desired user interface, I have created a PyQt Designer interface with a menu bar (see picture). But I have no idea how to connect these two interfaces.

Design by PyQt_Designer

Code from PyQt Designer:

from PyQt5 import QtCore, QtGui, QtWidgets

class Ui_MainWindow(object):
    def setupUi(self, MainWindow):

        MainWindow.resize(600, 300)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("../../Desktop/index.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)

        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.tableWidget = QtWidgets.QTableWidget(self.centralwidget)
        self.tableWidget.setGeometry(QtCore.QRect(0, 0, 600, 300))
        self.tableWidget.viewport().setProperty("cursor", QtGui.QCursor(QtCore.Qt.CrossCursor))

        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 600, 21))
        self.menuSelect = QtWidgets.QMenu(self.menubar)

        self.statusbar = QtWidgets.QStatusBar(MainWindow)


    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "Analyser"))
        self.menuSelect.setTitle(_translate("MainWindow", "Select File"))

if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    ui = Ui_MainWindow()

Can someone help me and tell me how to add a menu bar to my program or how to associate my program with the PyQt Designer code?

Error – dropdown menu problem only on the homepage?

Gday mens,

I am a beginner in the Web and have been running a website for a friend for some time. The latest version of WordPress has been available for over two years without major problems.

However, I am not sure if this is due to any of the various updates over time. I recently noticed that the site menu is not working properly. Drop-down menu items are not displayed. This issue only affects the homepage and not the other pages.

Initially, the menu was (wrongly) aligned at the bottom of the page, which was very wrong. That's why I used these instructions to bring it back up:

This brought the menu back to the foreground, but the current problem occurred.

Can someone take a look and advise please? Your help is greatly appreciated.
WordPress 5.2.4 (self-hosted)
Impreza latest version 30 Oct 19

8 – How do I get a section of the menu tree based on the current node?

A way was found to fulfill all cases without having to create multiple blocks (visibility rules would be odd) or create different menus. I could not achieve this by assuming a content type as in the question, since the same content type could be nested up to several areas of the menu and does not really know if the current depth you were in was a parent type (where ) The menu block should "start" (not necessarily the parent of the page).

I've decided to cheat a bit and use the URL and the alias pattern. If the current path matched a pattern and the URL consisted of a certain number of segments, I could see that I was in a particular part of the menu where the behavior should be different from others. In this case, the current page and its children should be used instead of the parent of the current page and its siblings:

class MenuBlockEnhanced extends MenuBlock {

   * {@inheritdoc}
  public function build() {
    $node = Drupal::routeMatch()->getParameter('node');

    // If we are not on a node route, get out.
    if (!$node) {
      return parent::build();

    // If the menu being rendered is not specifically the sub nav, get out.
    if ($this->configuration("suggestion") != 'subnav') {
      return parent::build();

    $current_path = Drupal::request()->getRequestUri();
    $parts = explode('/', $current_path);
    $build = parent::build();

    /** @var DrupalCoreMenuMenuLinkManager $menu_link_manager */
    $menu_link_manager = Drupal::service('plugin.manager.menu.link');
    $route_params = array('node' => $node->id());
    $menu_links = $menu_link_manager->loadLinksByRoute('entity.node.canonical', $route_params, 'main');
    $set_parent = TRUE;

    $params = new MenuTreeParameters();

    // I don't really know of another way to 'tell' we are on a project, since
    // a project can have projects under it. We can only rely on the path and
    // how many 'parts' are in the path - anything over 4 parts would be anything
    // nested in this section.
    if (preg_match('/programs-projects/i', $current_path) && count($parts) == 4) {
      $parent = reset($menu_links)->getPluginId();
      $set_parent = FALSE;
    } else {
      $parent = reset($menu_links)->getParent();

    $uuid = str_replace('menu_link_content:', '', $parent);
    $parent_menu_content = current(Drupal::entityTypeManager()
     ->loadByProperties(array('uuid' => $uuid)));

    $params->setActiveTrail(($parent, reset($menu_links)->getPluginId()));
    $tree = $this->menuTree->load($parent, $params);

    // Transform the tree using the manipulators you want.
    $manipulators = array(
      // Only show links that are accessible for the current user.
      array('callable' => 'menu.default_tree_manipulators:checkAccess'),
      // Use the default sorting of menu links.
      array('callable' => 'menu.default_tree_manipulators:generateIndexAndSort'),
    $tree = $this->menuTree->transform($tree, $manipulators);

    $link = end($parent_menu_content->link->getValue())('uri');

    $element = $this->menuTree->build($tree);
    $build('#items') = $element('#items')($parent)('below');

    if ($link != 'route:' && $set_parent) {
      $build('#top_parent') = $element('#items')($parent);

    if (empty($build('#cache')('contexts'))) {
      $build('#cache')('contexts') = ('user.permissions');
      $build('#cache')('tags') = ('config:system.menu.main');

    return $build;


The caching strategy comes exactly from what would normally be there, frankly, I probably do not even have to specify it since I'm already calling parent::build() and just reduce this code.

In the template I fix the problem "Do I only print siblings or this page and their children?" with the in_active_path check and simulate a control break in the twig macro (see: break = true):

{% import _self as menus %}

{{ menus.menu_links(items, attributes, 0, top_parent) }}

{% macro menu_links(items, attributes, menu_level, top_parent) %}
  {% import _self as menus %}

  {% if items %}
    {% if top_parent %}
    {% set parent_list_classes = ( 'secondary-nav__item', 'secondary-nav__item--parent' ) %} {% set parent_link_classes = ( 'link', 'link--left-arrow', ) %} {{ link(top_parent.title, top_parent.url, { 'class': parent_link_classes }) }} {{ menus.menu_child_links(items, attributes, 0) }}
{% else %} {{ menus.menu_child_links(items, attributes, 0) }} {% endif %} {% endif %} {% endmacro %} {% macro menu_child_links(items, attributes, menu_level) %} {% import _self as menus %}
    {% set break = false %} {% for item in items if not break %} {% set list_classes = ( 'secondary-nav__item', item.in_active_trail ? 'is-active' ) %} {{ link(item.title, item.url) }} {% if item.below and item.in_active_trail %} {% set break = true %} {{ menus.menu_child_links(item.below, attributes, menu_level + 1) }} {% endif %} {% endfor %}
{% endmacro %}

The menu works exactly as it is required in all cases. It goes to the maximum depth and secures the chain (with the parent blue link at the top).

The upgrade from 2.3.1 to 2.3.3 has been done. The billing address drop-down menu no longer appears on the checkout page

I hope to get some light on the subject here. After updating from 2.3.1 to 2.3.3 via Composer, you can use the drop-down menu in the frontend during the checkout page in the area where the user will change the billing address by unchecking "My billing and delivery address equals" with The billing address is no longer displayed.Payment method section screenshot

This behavior affects all payment methods that require a billing address. I tried to turn off my one-page checkout, and the behavior is the same. I contacted the one-page developer, and he told me that the problem is most likely related to the creation of themes or static files, but that no error log is displayed in system.log or in the exception, because the Problem persists .log. The theme is the default luma theme, no changes.

However, a warning appears on the Chrome web console checkout page:
Enter image description here

I have no idea where the mistake could be. I tried switching from production mode to developer mode, redeploying static content, clearing the cache, and clearing the cache, but everything does not seem to work.

The commands I did for the upgrade were:

php bin/magento maintenance:enable
composer require magento/product-community-edition=2.3.3 --no-update
composer require --dev allure-framework/allure-phpunit:~1.2.0 friendsofphp/php-cs-fixer:~2.14.0 lusitanian/oauth:~0.8.10 magento/magento-coding-standard:~3.0.0 magento/magento2-functional-testing-framework:2.4.5 pdepend/pdepend:2.5.2 phpmd/phpmd:@stable phpunit/phpunit:~6.5.0 sebastian/phpcpd:~3.0.0 squizlabs/php_codesniffer:~3.4.0 --sort-packages --no-update
composer update
bin/magento cache:clean
rm -rf var/cache/*
rm -rf var/page_cache/*
rm -rf generated/code/*
bin/magento setup:upgrade

Thanks for any help in advance.