dongqianzhan8325 2013-11-04 11:15
浏览 13
已采纳

为什么自定义帖子没有根据模板显示?

I am using crowdfunding by astoundify to ceate custom post type download(which is campaign actually). I have created a signle-download.php page as a template but post pages do not seem to use this template. Is there anything else I have to do?

code for single-download.php

    <?php

global $wp_embed;

get_header();

?>

<div class="bigcontainer4">
    <div class="container">
        <div id="content">
            <div class="clearfix">
                <?php while ( have_posts() ) : the_post(); $campaign = new ATCF_Campaign( $post->ID ); ?>
                <div class="project_content_line">
                    <div class="blog_post">
                        <div class="project_image_bg">
                            <div class="project_image">
                                <?php if ( $campaign->video() ) : ?>
                                <div class="project_video">
                                    <div class="project_videobox">
                                        <?php echo $wp_embed->run_shortcode( '[embed]' . $campaign->video() . '[/embed]' ); ?>
                                    </div>
                                </div>
                                <?php else :
                                the_post_thumbnail('blog-single-image');
                                endif; ?>
                            </div>
                            <h1>
                            <?php the_title() ;?>
                            </h1>
                        </div>
                    </div>
                    <div class="blog_sidebar">
                        <div class="project_sb_date">
                            <?php printf( __( '%s'), get_the_date('') ); ?>
                            -
                            <?php printf( __( '%s'), $campaign->end_date('') ); ?></div>
                        <div class="project_sb_date_rem">
                            <?php echo $campaign->
                            days_remaining(); ?>
                            <?php echo _n( $campaign->days_remaining(), 'day left', 'days left' ); ?></div>
                        <div class="project_small_excerpt">
                            <?php //echo excerpt(26); ?>

                            <div class="project_list_box_loader">
                                <div class="project_list_box_loaderbar">
                                    <span style="width: <?php echo $campaign->percent_completed(); ?>"></span>
                                </div>
                            </div>
                        </div>
                        <div class="project_money_data">
                            <div class="project_money_data1">
                                <p>
                                    <?php echo $campaign->current_amount(); ?></p>
                                <span>Raised</span>
                            </div>
                            <div class="project_money_data2">
                                <p></p>
                                <span>
                                    of
                                    <?php printf( __( '%s'), $campaign->goal() ); ?></span>
                            </div>
                            <?php if ( $campaign->is_active() )
                            echo edd_get_purchase_link( array(
                                'download_id' => $post->ID,
                                'class'       => '',
                                'price'       => false,
                                'text'        => __( 'Contribute Now', 'fundler' )
                            ) );
                            ?>
                        </div>
                    </div>
                    <div class="project_content_line">
                        <div class="blog_post">
                            <div class="project_content">
                                <?php the_content(); ?>

                                <div class="project_content_updates">
                                    <div class="project_sb_title">
                                        <p>Latest</p>
                                        <span>Updates</span>
                                    </div>
                                    <?php echo $campaign->updates() ?>
                                </div>
                                <?php comments_template(); ?>
                            </div>
                        </div>
                        <div class="blog_sidebar">
                            <div class="project_author_box">
                                <div class="project_sb_title">
                                    <p>About</p>
                                    <span>The Author</span>
                                </div>
                                <div class="project_author_image">
                                    <?php
                                    $author_email = get_the_author_meta('email');
                                    echo get_avatar($author_email, '512');
                                    ?>
                                    <div class="project_author_image_data">
                                        <p>
                                            <?php if ( '' != $campaign->author() ) :
                                            printf( __( '%s', 'fundler' ), esc_attr( $campaign->author() ) );
                                            endif; ?>
                                        </p>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php endwhile; ?>
<?php get_footer(); ?>
  • 写回答

1条回答 默认 最新

  • duanpai1920 2013-11-04 11:21
    关注

    According to Wordpress documentation:

    WordPress looks for template files with specific names in the current Theme's directory and uses the first matching template file listed under the appropriate query section below.

    So, I guess, you have another template matching condition. And wordpress uses it to display your page.

    Added from comment: May be you are using just another theme, not the one, your file resides in?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值