// часовой пояс Москва
$main_timezone = get_option( 'timezone_string', 'Europe/Moscow' );
date_default_timezone_set( "$main_timezone" );
// для даты создания
function main_get_the_date($the_date, $d, $post) {
$d = 'd.m.Y';
$date_now = date_format(date_create("now"), $d);
$date_yesterday = date_format(date_create("yesterday"), $d);
$post = get_post($post);
if ( !$post ) {
return $the_date;
}
$the_date = mysql2date( $d, $post->post_date);
if ($date_now == $the_date) {
$the_date = esc_html__( 'сегодня', 'main' );
} elseif ($date_yesterday == $the_date) {
$the_date = esc_html__( 'вчера', 'main' );
}
return $the_date;
}
add_filter( 'get_the_date', 'main_get_the_date', 10, 3 );
// для даты изменения
function main_get_the_modified_date($the_time, $d) {
$d = 'd.m.Y';
$date_now = date_format(date_create("now"), $d);
$date_yesterday = date_format(date_create("yesterday"), $d);
$the_time = get_post_modified_time($d, null, null, true);
if ($date_now == $the_time) {
$the_time = esc_html__( 'сегодня', 'main' );
} elseif ($date_yesterday == $the_time) {
$the_time = esc_html__( 'вчера', 'main' );
}
return $the_time;
}
add_filter( 'get_the_modified_date', 'main_get_the_modified_date', 10, 2 );
<?php
/**
* Search form
*/
?>
<form role="search" method="get" class="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<p><input type="search" id="searchfield" class="searchfield" name="s" placeholder="<?php esc_html_e( 'Search', 'main' ); ?>…" value="<?php echo get_search_query() ?>" required /></p>
<p><input type="submit" id="searchsubmit" class="searchsubmit" value="<?php esc_html_e( 'Find', 'main' ); ?>"></p>
</form>
[your-file][your-another-file]
/home/you/dir/dir/dir/fantasticpicture.jpg
uploads/2013/08/08/boringguide.pdf
add_action('init', function() {
$GLOBALS['wp_rewrite']->author_base = '';
}, 1);
administrator
заменить на publish_posts
.add_filter('show_admin_bar', '__return_false');
function set_user_admin_bar_false_by_default($user_id) {
update_user_meta( $user_id, 'show_admin_bar_front', 'false' );
}
add_action('user_register', 'set_user_admin_bar_false_by_default', 10, 1);
// Turn debugging on
define('WP_DEBUG', true);
// Tell WordPress to log everything to /wp-content/debug.log
define('WP_DEBUG_LOG', true);
// Turn on the display of error messages on your site
define('WP_DEBUG_DISPLAY', true);
the_content();
- это вывод контента.?>
или после </div>
wp_link_pages
- это пагинация.<?php
the_content();
?>
//ТУТ ВАШ КОД
<?php
wp_link_pages( array(
'before' => '<div style="clear: both;"></div><div class="pagination clearfix">'.__( 'Pages:', 'colormag' ),
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>'
) );
?>
/** CRON https://codex.wordpress.org/Editing_wp-config.php#Alternative_Cron **/
define('ALTERNATE_WP_CRON', true);
function SearchFilter($query) {
if ($query->is_search) {
$query->set('post_type', 'post');
}
return $query;
}
add_filter('pre_get_posts','SearchFilter');
add_filter('register_post_type_args', function($args, $post_type) {
if (!is_admin() && $post_type == 'page') {
$args['exclude_from_search'] = true;
}
return $args;
}, 10, 2);
// The following example is for adding a hook callback.
// define the woocommerce_calculated_total callback
function filter_woocommerce_calculated_total( $round, $instance ) {
// make filter magic happen here...
return $round;
};
// add the filter
add_filter( 'woocommerce_calculated_total', 'filter_woocommerce_calculated_total', 10, 2 );