dousi6192 2013-11-16 02:12
浏览 28

php echo concatenation中的语法错误

I have the following code in a Wordpress page template:

<?php $args = array( 'post_type' => 'casestudies', 'posts_per_page' => 12 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();

echo '<div class="casestudy">'.'<a href="<?php the_permalink() ?>" class="anchor- hover">'.get_the_post_thumbnail( $post->ID, '180,180' ).'</div>'.'</a>'; 
echo '<span class="details">'.'<div class="anchor-hover details-h3">'.the_title().'</div>';
echo '<p class="desc">'.get_post($post_id)->post_excerpt.'</p>'.'</span>';

endwhile; ?>

        <div class="clear"></div>

I need to wrap the entire display starting with "echo" with this div:

<div<?php post_class('margin') ?> id="post-<?php the_ID(); ?>">

The title and excerpt are only supposed to show when the cursor is hovering over the thumbnail, but I can't get this line of code in without an unexpected syntax error.

I am able to get this to work on the archive for this post type so there should be some way to do it.

  • 写回答

1条回答 默认 最新

  • dongmubei7950 2013-11-16 03:15
    关注
                                                                    | HERE                    | OR RATHER HERE
    echo '<div class="casestudy">'.'<a href="<?php the_permalink() ?>" class="anchor- hover">'.get_the_post_thumbnail( $post->ID, '180,180' ).'</div>'.'</a>'; 
    
    评论

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用