• Resolved enkayes

    (@enkayes)


    Hey forum,

    I’m trying to get a statement to check if a custom field exists and if it does, output some code.

    I’m pretty sure the if statement is working properly, but the variable to get the path is improperly coded.

    Am I correct with this? Does anyone see the issue?

    Thanks!

    –nks

    <?php
    $key = 'side-bar-video';
    $themeta = get_post_meta($post->ID, $key, TRUE);
    $path1 = TEMPLATEPATH . "/media/videos/" ;
    if($themeta != '') {
    	echo '
    	[kml_flashembed movie="' . $path1 . $themeta .  '" width="313" height="250"]
    	[/kml_flashembed]
    
    	';
    
       }
    
      ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter enkayes

    (@enkayes)

    and just to give more perspective…

    The custom field ‘side-bar-video’ has a value of *filename*.swf and the path to the file is /wp-content/themes/*my-theme*/media/videos/*filename*.swf

    Try..

    $path1 = get_bloginfo( 'template_directory' ) . "/media/videos/" ;

    Thread Starter enkayes

    (@enkayes)

    win!

    Thanks so much!

    I kept trying <?php bloginfo(‘template_url’); ?> but what having issues because of the opening and closing php tags. I didn’t even know that function existed.

    +5 internets to you.

    –nks

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Custom Fields If Statement’ is closed to new replies.