dongxia026531 2018-11-08 12:26
浏览 61

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

I'm trying to show the_content() in a related template file. It is working in 2 almost similar coded templates files. But if I use it in this template the page will not even load.

The code with 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

Any idea?

  • 写回答

1条回答 默认 最新

  • douzhan3900 2018-11-08 12:39
    关注

    You can do these things if you didn't do yet.

    First set the template as a template file. For that include these lines above all codes in template file.

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

    After that make the template selected from the post editing right sidebar panel in wordpress.

    Make sure U have defined define( 'WP_DEBUG', true ); in wp-config file.

    Thanks

    评论

报告相同问题?

悬赏问题

  • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
  • ¥20 关于URL获取的参数,无法执行二选一查询
  • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
  • ¥15 marlin编译错误,如何解决?
  • ¥15 有偿四位数,节约算法和扫描算法
  • ¥15 VUE项目怎么运行,系统打不开
  • ¥50 pointpillars等目标检测算法怎么融合注意力机制
  • ¥20 Vs code Mac系统 PHP Debug调试环境配置
  • ¥60 大一项目课,微信小程序
  • ¥15 求视频摘要youtube和ovp数据集