Skip to content

Instantly share code, notes, and snippets.

@nikolov-tmw
nikolov-tmw / custom-menu-panel.php
Last active February 22, 2024 21:29
This registers a custom meta box for nav menus and renders it. Obviously $my_items would ideally be not hard-coded and instead it would come somewhere from the DB. The custom items add to the menu and save properly, but will probably not be displayed correctly. You might need to hook to the 'wp_setup_nav_menu_item' filter in order to fix the men…
<?php
function my_register_menu_metabox() {
$custom_param = array( 0 => 'This param will be passed to my_render_menu_metabox' );
add_meta_box( 'my-menu-test-metabox', 'Test Menu Metabox', 'my_render_menu_metabox', 'nav-menus', 'side', 'default', $custom_param );
}
add_action( 'admin_head-nav-menus.php', 'my_register_menu_metabox' );
/**
@Butochnikov
Butochnikov / !all_country_laravel (rus).md
Last active May 22, 2022 12:41
Список всех стран и их сокращений (кодов) по стандарту ISO 3166-1 в формате "Schema class" для Laravel 4.

Описание.

Список всех стран и их сокращений (кодов) по стандарту ISO 3166-1 в формате "Schema class" для Laravel 4 на русском языке.

Инструкция.

  1. В консоли запустите команду: "php artisan migrate:make create_country_table --table=country --create";
  2. Замените содержимое файла "\app\database\migrations\xxxx_xx_xx_xxxxxx_create_country_table.php" содержимым файла "create_country_table.php" (см.ниже);
  3. Замените файл "\app\database\seeds\DatabaseSeeder.php" или его содержимое файлом "DatabaseSeeder.php";
  4. в консоли выполните команду: "php artisan migrate --seed";
  5. все.