public => false
функции register_post_type()
. У этой записи не будет ссылки во фронте, но будут все возможности редактирования в админке. Запросить записи для вывода во фронт можно произвольным запросом wp_query()
register_post_type()
и таксономию team для member с помощью register_taxonomy()
. Уникальная верстка для каждого типа контентаhttps://example.loc/?tab=rent&type=townhouse&room=2
pre_get_posts
получаете get-переменные с помощью get_query_var()
и $query->set()
редактируете глобальный запрос$file_import = get_stylesheet_directory() . '/data/baza.xlsx';
if ( $xlsx = SimpleXLSX::parse( $file_import ) ) {
$excel = $xlsx->rows(0);
foreach ( $excel as $key_r => $excel_row ) {
// rows.
foreach ( $excel_row as $key_c => $excel_col ) {
// cols.
}
}
}
wp_is_mobile()
, которая проверяет переменную $_SERVER['HTTP_USER_AGENT']
. Она не всегда работает, есть фильтр через который ее можно расширить, добавив дополнительные проверки отсюда detectmobilebrowsers.com$current_date = date( 'd-m-Y H:i:s' );
$publish_date = get_the_date( 'd-m-Y H:i:s' );
$modified_date = get_the_modified_date( 'd-m-Y H:i:s' );
if ( strtotime( $publish_date . ' + 1 day' ) > strtotime( $current_date ) ) {
echo '<div class="badge">' . __( 'New', 'themename' ) . '</div>';
}
get_the_modified_date()
echo '<div class="badge hidden" data-publish-date="' . esc_attr( get_the_date( 'd M Y H:i:s O' ) ) . '">' . __( 'New', 'themename' ) . '</div>';
/* Direktiva robots */
function wporg_wp_robots_add_follow( $robots ) {
unset( $robots['max-image-preview'] );
if ( ! isset( $robots['noindex'] ) ) {
$robots['index'] = true;
$robots['follow'] = true;
}
$robots['noodp'] = true;
$robots['noydir'] = true;
return $robots;
}
add_filter( 'wp_robots', 'wporg_wp_robots_add_follow' );
wp_enqueue_scripts
функциями wp_enqueue_style()
и wp_enqueue_script()
function common_scripts() {
wp_enqueue_style( 'common-styles', get_theme_file_uri( 'assets/css/common.min.css' ), array(), filemtime( get_theme_file_path( '/assets/css/common.min.css' ) ) );
wp_enqueue_script( 'common-scripts', get_theme_file_uri( 'assets/js/common.min.js' ), array( 'jquery' ), filemtime( get_theme_file_path( '/assets/js/common.min.js' ) ), true );
}
add_action( 'wp_enqueue_scripts', 'common_scripts' );
wp_add_inline_style()
function common_scripts() {
wp_enqueue_style( 'style', get_stylesheet_uri(), array(), filemtime( get_theme_file_path( '/style.css' ) ) );
$css = '
.breadcrumbs_yoast ul, .breadcrumbs_yoast ol {
padding: 0;
margin: 0;
list-style-type: none;
}
.breadcrumbs_yoast ul * , .breadcrumbs_yoast ol * {
vertical-align: top;
}
.breadcrumbs_yoast ul li, .breadcrumbs_yoast ol li {
display: inline-block;
margin-right: .25rem;
}
.breadcrumbs_yoast ul li:not(:first-child), .breadcrumbs_yoast ol li:not(:first-child) {
display: inline-block;
margin-left: .25rem;
}';
wp_add_inline_style( 'common-styles', $css );
}
add_action( 'wp_enqueue_scripts', 'common_scripts' );