Skip to content

Instantly share code, notes, and snippets.

@seojacky
Last active November 4, 2021 12:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seojacky/79adea6c27948eb7f3845ca1c80e0536 to your computer and use it in GitHub Desktop.
Save seojacky/79adea6c27948eb7f3845ca1c80e0536 to your computer and use it in GitHub Desktop.
button-like-link.php
<?php
//Эта функция добавляет в стандартное меню новый пункт
function add_last_nav_item($items) {
$items .= '<button class="btn_link" onclick="window.open(https://miracle-workers.ru/contact/);">Контакты</button>';
// $items .= '<form action="https://miracle-workers.ru/contact/"><button type="submit">Контакты</form>'; //другой вариант, без джс
//$items .= '<li>'.get_search_form(false) . '</li>'; //добавляем поиск
return $items;
}
add_filter('wp_nav_menu_items','add_last_nav_item');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment