解决Dynamic Content Gallery插件不能在默认主题使用的方法!

前段时间打算整个幻灯片插件,让首页显示幻灯片,打算使用Dynamic Content Gallery这款插件,但是启用之后,在loop.php里相应位置添加<?php dynamic_content_gallery(); ?>后却发现不仅首页显示幻灯片,分类目录却出现了错误,查看官网才发现上面提示不能在默认主题loop.php文件里使用!不得已禁用了插件。

通过这几天研究终于发现如何在默认主题twentyten里使用Dynamic Content Gallery插件,只需要在主题文件夹里index.php写入<?php dynamic_content_gallery(); ?>代码即可,写在注释前面,<div id="content" role="main">下面即可!

        <div id="container">
            <div id="content" role="main">
            <div>
            <?php dynamic_content_gallery(); ?>
            </div>
            <?php
            /* Run the loop to output the posts.
             * If you want to overload this in a child theme then include a file
             * called loop-index.php and that will be used instead.
             */
             get_template_part( 'loop', 'index' );
            ?>
            </div><!– #content –>
        </div><!– #container –>

此条目发表在技术, 日志分类目录,贴了, 标签。将固定链接加入收藏夹。