Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Charlie Merland

    (@caercam)

    Hi Matt,

    Don’t bother with Shortcodes, especially if you’re just generating an URL. Movie metadata are regular posts meta, so this simple piece of code will do the job:

    $imdb_id = get_post_meta( get_the_ID(), '_wpmoly_movie_imdb_id', $single = true );
    $url = esc_url( 'https://www.imdb.com/title/' . $imdb_id );

    If you want to extend this to every occurrence of an IMDb ID, try using this code instead ??

    Thread Starter Matt Blank

    (@mattblank)

    Thanks, but I don’t follow? I’ve pasted that in (with <? and ?>) around it, but nothing seems be be outputted?

    Plugin Author Charlie Merland

    (@caercam)

    Ah, sorry about that, should have mentioned you need a echo somewhere for this to be displayed. Replace your initial

    https://www.imdb.com/title/<?php echo do_shortcode('[movie_imdb_id]');?>

    With

    <?php echo esc_url( 'https://www.imdb.com/title/' . get_post_meta( get_the_ID(), '_wpmoly_movie_imdb_id', true ) ); ?>

    And you should be good to go!

    Thread Starter Matt Blank

    (@mattblank)

    Great!! Thank you SO much ??

    Plugin Author Charlie Merland

    (@caercam)

    You’re welcome!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘IMDB ID Value’ is closed to new replies.