Get_query_var не понимает структуру моих страницPhp

Кемеровские программисты php общаются здесь
Ответить
Anonymous
 Get_query_var не понимает структуру моих страниц

Сообщение Anonymous »

Я пытаюсь понять, как разбивка на страницы в моем коротком коде, все страницы отображаются нормально, и нажатие на соответствующую страницу также приводит к URL-адресу этой страницы, но данные страницы никогда не меняются на этой странице, они всегда остаются неизменными, и мое портфолио сообщения всегда одни и те же.... вот весь мой код, пожалуйста, помогите мне разобраться в этой проблеме.

Код: Выделить всё

$args = array(
'post_type' => 'portfolio',
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC',
'posts_per_page' => $num_posts,
);
$push_args = array_slice($args, 0, 2, true) + $stack + $stack_cat_all + array_slice($args, 2, count($args) - 1, true) ;

query_posts($push_args);
if($show_title == 'yes'){
$output = '';
$output .= ''.$element_title.'';
$output .= ''.$element_caption.'';
$output .= '';
}
global $paged;
if ( get_query_var('paged') ) {
$paged = get_query_var('paged');
} else if ( get_query_var('page') ) {
$paged = get_query_var('page');
} else {$paged = 1;}
$args = array (
'post_type' =>  'portfolio',
'posts_per_page' => $num_posts,
'post_status' => 'publish',
'paged' => $paged
);
$gallery_posts = new WP_Query($args);
if ( !empty($gallery_posts) ) {
if ($gallery_posts->have_posts()) {
while ($gallery_posts->have_posts()) {
$gallery_posts->the_post();
$terms = get_the_terms($post->ID, 'portfolio_category');
$links = array();
if (is_array($terms) || is_object($terms)) {
foreach ($terms as $term) {
$links[] = $term->name;
}
}
$links = str_replace(' ', '-', $links);
$tax = join(" ", $links);
$output .= '';
if ($thumbnail_position != 'below_title') {
if ($pretty_photo != 'no') {
$output .= '';
} else {
$output .= '';
}
}
if ($show_post_title != 'no') {
$output .= '' . get_the_title() . '';
}
if ($show_description != 'no') {
$output .= '
' . $content = substr(get_the_content(), 0, $num_characters) . '
';
}
if ($thumbnail_position == 'below_title') {
if ($pretty_photo != 'no') {
$output .= '';
} else {
$output .= '';
}
}

if ($read_more != '') {
$read_more = $read_more;
} else {
$read_more = 'Read More';
}
if (($show_post_title != 'no') && ($show_description != 'no')) {
$output .= '' . $read_more .  '';
}
$output .= '';
}

$output .= '';

//$output .= paginate_links( $args );
if($show_pagination != 'no') {
$big = 999999999;
$output .= '' . paginate_links(array(
'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
'format' => '?paged=%#%',
'current' => max(1, get_query_var('paged')),
'total' => $gallery_posts->max_num_pages
));
$output .= '';
}
wp_reset_query();
wp_reset_postdata();

return $output;
}
}}
Это действительно убивает меня, потому что я уже потратил 3 часа впустую :(

Подробнее здесь: https://stackoverflow.com/questions/378 ... -structure
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Php»