dongyuans61046 2016-10-31 15:43
浏览 8

变量的后循环输出

I have a archives-movies.php which outputs the information I want.

In the $rat variable, I wanted to output the value as well as an image that I have uploaded to theme directory/img/stars/ with separate folders for the output as in folder 0,1,2,3,4 ... 10 and star.png in all the separate folders.

<?php
    $nam = get_post_meta( get_the_ID(), "name", true );
    $rel = get_post_meta( get_the_ID(), "released", true );
    $rat = get_post_meta( get_the_ID(), "rating", true );
    $dur = get_post_meta( get_the_ID(), "duration", true );
    $gen = get_post_meta( get_the_ID(), "genre", true );
    $dir = get_post_meta( get_the_ID(), "director", true );
    $wri = get_post_meta( get_the_ID(), "writer", true );
    $sta = get_post_meta( get_the_ID(), "stars", true );
    $sto = get_post_meta( get_the_ID(), "storyline", true );
?>

<div class="align_Left">
    <p><b>Title:</b>&nbsp;<?php echo $nam; ?></p>
    <p><b>Released:</b>&nbsp;<?php echo $rel; ?></p>
    <p><b>Rating:</b>&nbsp;<?php echo $rat; ?>/10</p><img src="<?php echo get_theme_directory_uri() ;?>/img/stars/<?php echo $rat; ?>/star.png"> 
    <p><b>Duration:</b>&nbsp;<?php echo $dur; ?>&nbsp;min</p>
    <p><b>Genre:</b>&nbsp;<?php echo $gen; ?></p>
    <p><b>Director/s:</b>&nbsp;<?php echo $dir; ?></p>
    <p><b>Writer/s:</b>&nbsp;<?php echo $wri; ?></p>
    <p><b>Stars:</b>&nbsp;<?php echo $sta; ?></p>
    <p><b>Storyline:</b>&nbsp;<?php echo $sto; ?></p>
</div>

<?php wp_reset_postdata() ?>

But doesn't work.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信小程序协议怎么写
    • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
    • ¥20 怎么用dlib库的算法识别小麦病虫害
    • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
    • ¥15 java写代码遇到问题,求帮助
    • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看