• Heya,
    So I need to find a way to and some sort of else statement that says if there us no value in the url area that it should use generic-image.png. Can someone help? Thanks!

    if (have_posts()) :
    			while (have_posts()) : the_post();
    				if(!$currentPost){
    					$currentPost = $post;
    				}
    
    				$key="Image on the top"; echo "style='background: url(" . get_post_meta($currentPost->ID, $key, true) . ");'";
    			endwhile;
    		endif;
Viewing 1 replies (of 1 total)
  • How about:

    if (have_posts()) : while (have_posts()) : the_post();
    if(!$currentPost) $currentPost = $post;
    $key="Image on the top";
    if(  get_post_meta($currentPost->ID, $key, true) ) echo "style='background: url(" . get_post_meta($currentPost->ID, $key, true) . ");'";
    endwhile;endif;
Viewing 1 replies (of 1 total)
  • The topic ‘PHP else, need help…’ is closed to new replies.