【问题标题】:Cant change Wordpress slider's post text to post title无法将 Wordpress 滑块的帖子文本更改为帖子标题
【发布时间】:2015-03-02 17:41:10
【问题描述】:

我想在我的 wordpress 滑块上使用帖子标题而不是帖子文本,但是当我将 the_post 更改为 the_title 时出现问题。

<ul class="slides">
    <?php 

        $slide = get_option('cany_slide_cat');
        $count = get_option('cany_slide_count');
        $slide_query = new WP_Query( 'category_name='.$slide.'&posts_per_page='.$count.'' );
        while ( $slide_query->have_posts() ) : $slide_query->the_post();
  $do_not_duplicate[] = $post->ID 
    ?>  
    <li>
    <a href="<?php the_permalink() ?>"><img class="slideimg" src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php echo get_image_url()?>&amp;h=300&amp;w=650&amp;zc=1" title="" alt="" /></a>
    <div class="flex-caption">
    <?php wpe_excerpt('wpe_excerptlength_slide', ''); ?>
    </div>
    </li>
    <?php endwhile; ?>
    </ul>

我的网页网址是:http://soccerway.ge/

提前谢谢你

【问题讨论】:

    标签: php jquery wordpress


    【解决方案1】:

    我假设您已尝试将 $slide_query-&gt;the_post() 更改为 $slide_query-&gt;the_title()

    那是行不通的,不要以这种方式修改循环。

    您真正想做的(我认为,您的问题尚不清楚)是将the_title 拉入 flex-caption div 而不是摘录(大概是因为没有摘录被拉入全文明确设置)。

    <div class="flex-caption">
       <?php the_title(): ?>
    </div>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-07-26
      • 1970-01-01
      • 2014-12-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-31
      • 2022-09-23
      相关资源
      最近更新 更多