PHP
0
Вклад в тег
/* Start: Register Post Type (Universities Pages) */
function custom_post_type_universities_pages() {
$labels = array(
'name' => _x('Universities Pages', 'post type general name', 'your-text-domain'),
'singular_name' => _x('Universities Page', 'post type singular name', 'your-text-domain'),
// Добавьте другие метки по вашему усмотрению
);
$args = array(
'labels' => $labels,
'public' => true,
'supports' => array('title','editor','author','comments'), // Включение поддержки комментариев
);
register_post_type('universities_page', $args);
}
add_action('init', 'custom_post_type_universities_pages');
/* Start: Rewrite URL's */
function custom_rewrite_rule() {
add_rewrite_rule('^([^/]+)/([^/]+)/([^/]+)/?$', 'index.php?pagename=university&country=$matches[1]&city=$matches[2]&university_slug=$matches[3]', 'top');
}
add_action('init', 'custom_rewrite_rule');
function custom_rewrite_tag() {
add_rewrite_tag('%country%', '([^&]+)');
add_rewrite_tag('%city%', '([^&]+)');
add_rewrite_tag('%university_slug%', '([^&]+)');
}
add_action('init', 'custom_rewrite_tag');
<a href="<?php echo home_url('/' . $university_data->country . '/' . $university_data->city . '/' . $university_data->slug); ?>" class="text-size-medium text-weight-bold"><?php echo esc_html($university_data->name); ?></a>
домен/%country%/%city%/%postname%/
extension=php_curl.dll;
extension=php_gd2.dll;
extension=php_mbstring.dll;
extension=php_openssl.dll;
extension=php_pdo_mysql.dll;
extension=php_pdo_sqlite.dll;
extension=php_sqlite3.dll.