变量

时间:2016-10-31 15:43:18

标签: php wordpress post-meta

我有一个archives-movies.php,可以输出我想要的信息。

$rat变量中,我想输出值以及我上传到主题目录/ img / stars /的图像,并在文件夹0,1,2中输出单独的文件夹,所有单独的文件夹中都有3,4 ... 10和star.png。

<?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() ?>

但是不起作用。

0 个答案:

没有答案