<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link href="https://fonts.googleapis.com/css?family=Roboto:400,700i&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.2/css/all.min.css">
<link rel="stylesheet" href="/css/profile.css">
</head>
<body>
<header class="header_wrapper">
<div class="head-item">
<div class="logotype">
<a href="#" alt="logo">logo</a>
</div>
</div>
<div class="head-item">
<form action="/search" method="post">
<input type="search" results=5 size="13" name="" placeholder="Поиск" class="input" />
</form>\
<nav class="navigation">
<ul class="nav">
<li class="leftmenutop"><a href="#">Новости</a></li>
<li class="leftmenutop"><a href="#">Рейтинг</a></li>
<li class="leftmenutop"><a href="#">Соревнования</a></li>
<li class="leftmenutop"><a href="#">Событие</a></li>
</ul>
</nav>
<div class="icons">
<a href="#"><i class="fas fa-bell"></i></a>
<a href="#"><i class="fas fa-bell"></i></a>
<a href="#"><i class="fas fa-bell"></i></a>
<a href="#"><i class="fas fa-bell"></i></a>
</div>
</div>
</header>
<aside class="sidebar">
<nav>
<ul class="ul-list work-programm">
<li class="programm-work-menu-1"><a href="#">Главная</a></li>
<li class="programm-work-menu-1"><a href="#">Программы тренировок</a></li>
<li class="programm-work-menu-1"><a href="#">Подтягивания</a></li>
<li class="programm-work-menu-1"><a href="#">Отжимания</a></li>
<li class="programm-work-menu-1"><a href="#">Приседания</a></li>
<li class="programm-work-menu-1"><a href="#">Брусья</a></li>
</ul>
</nav>
</aside>
</body>
</html>
<?php
function generate_title( $post_id, $post ){
if ( 'slug' == $post->post_type ) {
$field1 = get_post_meta( $post_id, 'key', true );
$field2 = get_post_meta( $post_id, 'key', true );
$title_fileds = $field1 . " " . $field2;
$new_title = sanitize_text_field( $title_fileds );
$new_slug = sanitize_title( $new_title );
$args = array(
'ID' => $post_id,
'post_title' => $new_title,
'post_name' => $new_slug
);
// unhook this function so it doesn't loop infinitely
remove_action('save_post', 'generate_title',30,2);
// update the post, which calls save_post again
wp_update_post( $args );
// re-hook this function
add_action('save_post', 'generate_title',30,2);
}
}
add_action( 'save_post', 'generate_title', 30, 2 );
?>