Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

Hidoshi on "Echoing PHP inside of PHP with a link"

$
0
0

My familiarity with PHP is a little rusty right now. I'm trying this:

<?php
if ( has_post_thumbnail() ) {
	echo ("<div class="content-left" style="background-image:url( '" . $image_url[0] . "' );"></div>");
}
else {
	echo 'Blah';
}
?>

Which, according to my hack-together understanding, should get me an if/else situation where the background image gets pulled from the post thumbnail, or it just prints "blah" if none is available.

Now, the code for the post thumbnail is fine. It works properly. Introducing the if/else PHP, however, has broken it. I feel like I'm just missing a key piece of syntax in here. Anyone have any ideas? Thanks!


Viewing all articles
Browse latest Browse all 8245

Trending Articles