Php 函数后未加载wordpress页脚
我使用的是php代码,我发现它可以计算wordpress中post中的所有图像 但在此代码之后,页脚和侧边栏都没有加载。我修不好。这是我页面的全部代码。“计数器代码”位于“照片库计数器”部分。在它之后什么都没有加载Php 函数后未加载wordpress页脚,php,wordpress,Php,Wordpress,我使用的是php代码,我发现它可以计算wordpress中post中的所有图像 但在此代码之后,页脚和侧边栏都没有加载。我修不好。这是我页面的全部代码。“计数器代码”位于“照片库计数器”部分。在它之后什么都没有加载 <?php /* Template Name: Страница фотогалереи */ ?> <?php get_header();?> <div class="center-part" sty
<?php
/*
Template Name: Страница фотогалереи
*/ ?>
<?php get_header();?>
<div class="center-part" style="max-width: 73%;">
<div class="padding-side" style="margin: 0 40px;">
<section class="article">
<div class="h2" style="margin-top: -14px">
<h2>Фотоальбомы</h2></div>
<div class="photo_gallery">
<div class="photo_gallery_grid">
<?php if (have_posts()) :
$args = array(
'post_type' => 'fotoalbum',
'publish' => true,
'paged' => get_query_var('paged'),
);
query_posts($args);
while (have_posts()) : the_post(); ?>
<div class="photo_gallery_album">
<a href="<?php the_permalink(); ?>" class="photo_gallery_link">
<?php
$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'large');
?>
<div class="photo_gallery_item" style="background-image: url(<?php echo $thumbnail[0]; ?>);">
<div class="photo_gallery_item_info">
<div class="photo_gallery_title">
<?php the_title(); ?>
</div>
<div class="photo_gallery_counter">
<?php
// Get all the attachments
// Get all the galleries in the current post
$galleries = get_post_galleries( get_the_ID(), false );
// Count all the galleries
$total_gal = count( $galleries );
/**
* count all the images
* @param array $array The array needed
* @return int returns the number of images in the post
*/
function _get_total_images( $array ){
$key = 0;
$src = 0;
while ( $key < count( $array ) ){
$src += count( $array[$key]['src'] );
$key++;
}
return intval( $src );
}
echo _get_total_images( $galleries );
?>
</div>
</div>
</div>
</a>
</div>
<?php endwhile;?>
<?php endif;?>
</div>
</div>
</section>
</div>
</div><!-- end of gallery-->
<?php get_sidebar('single'); ?>
<?php get_footer(); ?>
Фотоальбомы
这是一个php错误,导致页面的其余部分无法确定加载。我注意到您的代码中有一个错误,这可能是罪魁祸首,但也可能有其他错误。改变
$galleries = get_post_galleries( get_the_ID(), false );
到
关于函数的更多信息:
请告诉我这是否解决了:)这是一个php错误,导致页面的其余部分无法确定加载。我注意到您的代码中有一个错误,这可能是罪魁祸首,但也可能有其他错误。改变
$galleries = get_post_galleries( get_the_ID(), false );
到
有关此函数的更多信息:
请告诉我是否解决了此问题:)您是否检查了日志?来自gallery插件的代码可能会抛出任何致命错误,从而停止解析代码。不,日志中没有错误。您检查了哪些日志路径?它不是插件。子页面上有自定义wp库。在浏览器控制台中是否检查日志?来自gallery插件的代码可能会抛出任何致命错误,从而停止解析代码。不,日志中没有错误。您检查了哪些日志路径?它不是插件。子页面上有自定义wp库。在浏览器控制台中,此库不起作用。我认为这段代码还可以,因为它正在工作。结果将显示在页面上。抱歉,它不起作用。我认为这段代码还可以,因为它正在工作。结果将显示在页面上。