为什么我的WordPress自定义主题页面中没有显示图片库插件的oputput?

安德里亚·诺比利(AndreaNobili)

作为WordPress开发人员,我还很陌生,我为自己开发的主题(从0开始)而疯狂。

因此,您可以在此链接中下载整个主题,以便在详细信息中看到整个代码:http : //www.asper-eritrea.com/AsperThemeV2.zip

在这个网站上,我尝试安装一个名为GMedia Gallery的图片库插件(我也尝试与其他插件一起使用,但我也遇到类似的问题),这个插件是:https : //it.wordpress.org/plugins/grand-media/

使用这个插件,我创建了一个图库,然后进入:

外观->菜单-> GMedia画廊--->我的画廊我将创建的画廊作为页面添加到主菜单中。

在这里,我遇到了一个大问题,因为使用我的自定义主题,单击主菜单中的相关链接,没有显示图库,并且appera页面为空,如下所示:

http://www.asper-eritrea.com/gmedia-gallery/eventi-e-manifestazioni/

我非常确定这是与我的主题相关的问题,因为切换到任何默认的WordPress主题(例如Twenty Twelve)都会在页面中正确显示画廊,下面的屏幕快照证明了这一说法:

在此处输入图片说明

因此,问题必须与我的自定义主题有关,因为使用其他主题可以正常工作!!!

我真的不知道这个问题的原因。我认为这可能取决于我已经定制了content-page.php文件,或者它可能与某些JQuery问题有关。

在特定情况下,如您所见,打开主题项目,我将JQuery添加到/ assets / js /目录中,然后将对主题的JQuery支持添加到function.php文件中,方法是:

/* Function automatically executed by the hook 'load_java_scripts':
 * 1) Load all my JavaScripts
 */
function load_java_scripts() {

    // Load JQuery:
    wp_enqueue_script('jquery');
    // Load FlexSlider JavaScript
    wp_enqueue_script('flexSlider-js', get_template_directory_uri() . '/assets/plugins/flexslider/jquery.flexslider.js', array('jquery'), 'v2.1', true);
    // Load bootstrap.min.js:
    wp_enqueue_script('bootstrap.min-js', get_template_directory_uri() . '/assets/bootstrap/js/bootstrap.min.js', array('jquery'), 'v3.0.3', true);

    // Load FancyBox:
    wp_enqueue_script('fancy-js', get_template_directory_uri() . '/assets/plugins/fancybox/jquery.fancybox.pack.js', array('jquery'), 'v2.1.5', true);
    // Load scripts.js:
    wp_enqueue_script('myScripts-js', get_template_directory_uri() . '/assets/js/scripts.js', array('jquery'), '1.0', true);
    // Load Modernizer:
    wp_enqueue_script('myodernizer-js', get_template_directory_uri() . '/assets/js/modernizr.custom.js', array('jquery'), '2.6.2', true);

}

add_action('wp_enqueue_scripts', 'load_java_scripts');

但是我不确定它是正确的,因为当我这样做时:

// Load JQuery:
wp_enqueue_script('jquery');

我没有指定jquery.js文件的路径,那么究竟在做什么呢?(我已经做过很多次了)。

那么可能是什么问题呢?我该如何解决?

Tnx这么多

编辑1:如建议的那样,我将分析content-page.php文件的内容,该文件应该表示page.php所使用的模板,该模板表示CMS中的通用页面(我认为很可能是画廊插件被推入):

<?php
/**
 * The default template for displaying content
 *
 * Used for both single and index/archive/search.
 *
 * @package WordPress
 * @subpackage AsperTheme
 * @since AsperTheme 1.0
 */
?>


<!-- Create a div with a unique ID thanks to the_ID() and semantic classes with post_class() 
     the_ID(): Print the numeric ID of the current post 
     post_class(): Print out and add various post-related classes to the div tag
-->
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>                              

    <header>
        <h3 class="entry-title">
                <a href="<?php the_permalink(); ?>" 
                   title="<?php printf(__('Permalink to %s', 'your-theme'), the_title_attribute('echo=0')); ?>"
                   rel="bookmark"><?php the_title(); ?>
                </a>

        </h3>

        <div class="entry-meta-page">
            <span class="meta-prep meta-prep-author"><?php _e('By ', 'your-theme'); ?></span>
            <span class="author vcard">
                <a class="url fn n" href="<?php echo get_author_link(false, $authordata -> ID, $authordata -> user_nicename); ?>" 
                                    title="<?php printf(__('View all posts by %s', 'your-theme'), $authordata -> display_name); ?>"><?php the_author(); ?>
                </a>
            </span>
            <span class="meta-sep"> | </span>
            <span class="meta-prep meta-prep-entry-date"><?php _e('Published ', 'your-theme'); ?></span>
            <span class="entry-date">
                <abbr class="published" title="<?php the_time('Y-m-d\TH:i:sO') ?>"><?php the_time(get_option('date_format')); ?></abbr>
            </span>
            <?php edit_post_link( __( 'Edit', 'your-theme' ), "<span class=\"meta-sep\">|</span>\n\t\t\t\t\t\t<span class=\"edit-link\">", "</span>\n\t\t\t\t\t" ) ?>
         </div>     <!-- .entry-meta -->

    </header>

    <div class="entry-content">    
        <?php the_content(__('Continue reading <span class="meta-nav">&raquo;</span>', 'your-theme')); ?>
        <?php wp_link_pages('before=<div class="page-link">' . __( 'Pages:', 'your-theme' ) . '&after=</div>') ?>
    </div>      <!-- .entry-content -->

    <!--
    <div class="entry-utility">

        <span class="cat-links">
            <span class="entry-utility-prep entry-utility-prep-cat-links"><?php _e('Posted in ', 'your-theme'); ?></span>
            <?php echo get_the_category_list(', '); ?>
        </span>

        <span class="meta-sep"> | </span>

        <?php the_tags( '<span class="tag-links"><span class="entry-utility-prep entry-utility-prep-tag-links">' . __('Tagged ', 'your-theme' ) . '</span>', ", ", "</span>\n\t\t\t\t\t\t<span class=\"meta-sep\">|</span>\n" ) ?>
            <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'your-theme' ), __( '1 Comment', 'your-theme' ), __( '% Comments', 'your-theme' ) ) ?></span>
            <?php edit_post_link( __( 'Edit', 'your-theme' ), "<span class=\"meta-sep\">|</span>\n\t\t\t\t\t\t<span class=\"edit-link\">", "</span>\n\t\t\t\t\t\n" ) ?>
    </div>      <!-- #entry-utility 
    -->

</article>  <!-- #post-<?php the_ID(); ?> -->

因此,似乎这里没有引用the_content()函数。但是,为什么我要使用the_content()函数来显示我的画廊?在官方文档上,它是用来显示帖子内容的,它与插件输出有什么关系?

幸运猎人

在您的网站上,我在入口内容内看到了图库,但是它带有注释,因此没有显示。

参见下面的代码:

<div class="entry-content">
  <!--<div class="gmedia_gallery phantom_module" id="GmediaGallery_3" data-gallery="3" data-module="phantom"> ... </div>-->
</div>

在其他页面(例如here)上,您的内容显示两次:第一次被评论,第二次不带评论并且显示正常。

尝试检查single.phpcontent-page.php中的the_content()函数

这可能会有所帮助。

更新1

这里的代码复制页面的内容。文件contentPost.php [line:47]

<!--<?php the_content(__('Continue reading <span class="meta-nav">&raquo;</span>', 'your-theme')); ?>-->

此代码必须删除或正确注释:

<?php //the_content(__('Continue reading <span class="meta-nav">&raquo;</span>', 'your-theme')); ?>

我正在激活您的主题并创建带有测试库的帖子http://template.dev-city.me/gallery/

更新2

有关WordPress主题开发的更多信息。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

为什么我的自定义登录页面没有显示在Spring Security 4中?

为什么我的自定义菜单没有显示在Wordpress中?

WordPress 自定义图片库链接到自定义图像大小

为什么我的android自定义帐户没有显示在“帐户和设置”中?

为什么我的自定义帖子类型没有显示在管理菜单中?

为什么我的 React 组件没有更新图片库?

WordPress自定义页面主题显示当前用户的帖子

如何使自定义 WordPress 主题显示页面,而不是帖子

为什么我的静态首页自定义模板没有显示?

HTML - 为什么我的自定义 css 非动画光标没有显示?

像Flickr这样的Android自定义图片库

为什么图片没有显示在我的HTML中?

为什么我的图片没有显示在 recyclerview 中?

为什么我的网址中的图片没有显示?

WordPress主题页面未显示插件库

WordPress在没有插件的情况下向页面添加自定义字段

为什么Wordpress会覆盖我的自定义TwentyTwelve主题?

我的自定义DialogFragment没有显示在活动中

为什么将 SelectedItem 作为自定义对象传递到新页面后没有显示内容?

如何在没有插件的自定义wordpress主题中添加带有图标的搜索框

在自定义页面中WordPress上传图片

为什么我的Javascript警报不适用于此自定义WordPress插件?

自定义图像查看器。复制后未显示简单的图片库,奇怪的行为

没有在appbuilder中显示ArcGIS / Esri自定义主题

如何使用图片库自定义Codeigniter水印文本和图片?

为什么我的自定义操作符没有导入到我的DAG(气流)中?

WordPress的-自定义存档页面没有预先张贴?

WordPress自定义菜单显示所有页面

Jenkins多配置项目在构建步骤中没有显示自定义插件?