How to cache a Drupal’s main menu when load programmatically

I am having the below code to load the main menu tree. $tree = menu_tree_all_data(‘main-menu’); $parentMenu = array(); $index = 0; foreach($tree as $key => $value) { if (!empty($value[‘link’][‘hidden’])) { continue; } $submenu = array(); foreach($value[‘below’] as $subMenu) { if (!empty($subMenu[‘link’][‘hidden’])) { continue; } $tid = explode(‘/’, $subMenu[‘link’][‘link_path’]); $submenu[]= array( ‘link_title’ => $subMenu[‘link’][‘link_title’], ‘link_path’ =>…

Post Does not show category wish just show latest post

function category_post_shortcode($atts){ extract(shortcode_atts(array( ‘title’ => ”, ‘link’ => ”, ‘category’ => ”, ), $atts, ‘category_post’ ) ); $q = new WP_Query( array( ‘category’ => $category, ‘posts_per_page’ => ‘3’, ‘post_type’ => ‘post’) ); $list = ‘<div class=”latest_form_category”><h2 class=”latest_form_category_title”>’.$title.'</h2><a href=”‘.$link.'” class=”latest_more_link”>More</a><div class=”total_cat_post”>’; while($q->have_posts()) : $q->the_post(); $id = get_the_ID(); $post_excerpt = get_post_meta($id, ‘post_excerpt’, true); $post_thumbnail = get_the_post_thumbnail( $id,…

How to refresh Composer install to restore missing (deleted) files

I attempted to install the 8.8.1 Drupal Core security update using the command composer update drupal/core webflo/drupal-core-require-dev –with-dependencies I’ve used this many times. However, this time the update failed with the fatal error message Uncaught Error: Class ‘Symfony\Component\Finder\Finder’ not found in <referring file> The Finder class is defined in the file vendor/symfony/finder/Finder.php. I checked and…

Why does the FormController instantiate models with the ignore_request flag set to true?

The Joomla\CMS\MVC\Controller\FormController::getModel method has a default argument for the config argument that sets the ignore_request parameter to true. This in turn means that models will not call the populateState method. Why is the FormController, the only controller to prevent populateState being called? What is the reason that you wouldn’t want populateState to be called when…

Getting file errors in a WordPress Multisite ADMIN

Both front and back end are getting loading errors in the Inspect Console because the path to the files in “wp-includes” and “wp-admin” are wrong. I have sunrise.php activated. These are the lines I added to wp-config.php /* Multisite */ define( ‘WP_ALLOW_MULTISITE’, true ); define(‘MULTISITE’, true); define(‘SUBDOMAIN_INSTALL’, false); define(‘DOMAIN_CURRENT_SITE’, ‘MY-DOMAIN’); // <- my real domain…

How to show detailed user order history on woocommerce product page

i need show detailed user order history on woocommerce product page. this code worked but show all orders product! I want to show user orders that are logined, not all orders… <?php echo ‘<h2>Previous Donations for this Nonprofit</h2>’; foreach (get_posts(‘post_type=shop_order&numberposts=-1&post_status=wc-completed’) as $order) { $order = new WC_Order($order->ID); foreach($order->get_items(‘line_item’) as $item) { if ($post->ID == $item[‘product_id’]…