繁体   English   中英

内容(); 在自定义模板中不起作用

[英]the_content(); not working in custom template

我正在尝试在相关的模板文件中显示the_content() 它在2个几乎相似的编码模板文件中工作。 但是,如果我在此模板中使用它,则该页面甚至都不会加载。

带有the_content();的代码the_content();

if( $eddrd_query->have_posts() && $go  ) { ?>
            <div id="layero-related-downloads">
                <h3><?php echo $related_dl_title; ?></h3>
                <div id="edd-related-items-wrapper" class="edd-rp-single">
                    <?php $countRow = 1; // Editted: for creating 3 item rows
                    while ($eddrd_query->have_posts()) {
                            $eddrd_query->the_post();
                            if ($post->ID == $exclude_post_id) continue;

                            if ($countRow%3 == 1) { // Editted: for creating 3 item rows
                                echo "<div class='row'>";
                            }   ?>
                                <div class="col-md-4">
                                    <div class="edd_download_inner">
                                     <?php the_content(); ?>
                                        <div class="thumb">
                                            <?php
                                            $thumbID=get_post_thumbnail_id(get_the_ID());
                                            $featImage=wp_get_attachment_image_src($thumbID,'olam-product-thumb');
                                            $featImage=$featImage[0]; 
                                            $alt = get_post_meta($thumbID, '_wp_attachment_image_alt', true);

                                            $square_img = get_post_meta(get_the_ID(),"download_item_square_img");

                                        // feat vid code start

任何想法?

如果您还没有做的话,您可以做这些事情。

首先将模板设置为模板文件。 为此,请在模板文件中所有代码上方包含这些行。

<?php
/*
 * Template Name: myTemplate
 */

之后,从WordPress的后编辑右侧工具栏中选择模板。

确保U已定义define( 'WP_DEBUG', true ); 在wp-config文件中。

谢谢

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM