0

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.

Racil Hilan
  • 24,690
  • 13
  • 50
  • 55
scottiescotsman
  • 73
  • 2
  • 12

0 Answers0