global $posts, $numpages;
$request_uri = $_SERVER['REQUEST_URI'];
$result = preg_match('%\/(\d)+(\/)?$%', $request_uri, $matches);
$ordinal = $result ? intval($matches[1]) : FALSE;
if(is_numeric($ordinal)) {
// a numbered page was requested: validate it
// look-ahead: initialises the global $numpages
setup_postdata($posts[0]); // yes, hack
$redirect_to = ($ordinal < 2) ? '/': (($ordinal > $numpages) ? "/$numpages" : FALSE);
if(is_string($redirect_to)) {
// we got us a phantom
$redirect_url = get_option('home') . preg_replace('%'.$matches[0].'%', $redirect_to, $request_uri);
// if page = 0 or 1, redirect permanently
if($ordinal < 2) {
header($_SERVER['SERVER_PROTOCOL'] . ' 301 Moved Permanently');
} else {
header($_SERVER['SERVER_PROTOCOL'] . ' 302 Found');
}
header("Location: $redirect_url");
exit();
}
}
global $posts, $numpages;
$request_uri = $_SERVER['REQUEST_URI'];
$result = preg_match('%\/(\d)+(\/)?$%', $request_uri, $matches);
$ordinal = $result ? intval($matches[1]) : FALSE;
if(is_numeric($ordinal)) {
// a numbered page was requested: validate it
// look-ahead: initialises the global $numpages
setup_postdata($posts[0]); // yes, hack
$redirect_to = ($ordinal < 2) ? '/': (($ordinal > $numpages) ? "/$numpages" : FALSE);
if(is_string($redirect_to)) {
// we got us a phantom
$redirect_url = get_option('home') . preg_replace('%'.$matches[0].'%', $redirect_to, $request_uri);
// if page = 0 or 1, redirect permanently
if($ordinal < 2) {
header($_SERVER['SERVER_PROTOCOL'] . ' 301 Moved Permanently');
} else {
header($_SERVER['SERVER_PROTOCOL'] . ' 302 Found');
}
header("Location: $redirect_url");
exit();
}
}
<?php echo get_post_meta( $post->ID, 'name', true );
<input type="file" name="imgs[]">
include_once ABSPATH . 'wp-admin/includes/media.php';
include_once ABSPATH . 'wp-admin/includes/file.php';
include_once ABSPATH . 'wp-admin/includes/image.php';
if ( get_post_meta( get_the_ID(), 'images', false ) ){ //images название вашего произвольного поля
$image_array = get_post_meta( get_the_ID(), 'images', false ); //images название вашего произвольного поля
}
if ( $image_array ) {
foreach ( $image_array as $image ) {
$thumbimg = wp_get_attachment_image( $image['ID'], 'thumbnail');
$fullimg = pods_image_url( $image['ID'], 'large');
echo '<a href="'. $fullimg . '">' . $thumbimg . '</a>';
}
}
<a href="<?php the_post_thumbnail_url('full'); ?>">
<img src="<?php the_post_thumbnail_url('thumbnail'); ?>" alt="" title="<?php the_title(); ?>"/>
</a>
add_image_size( 'image-size-name', 285, 190, true );
<?php echo get_post_meta( $post->ID, 'name-field', true );