<?php
$custom_field = get_post_meta($post->ID, "secim", $single = true);
if($custom_field !== '')
{
echo'
<div class="arsiv">
<a href="<?php the_field('pdf'); ?>" target="_blank"><img src="<?php the_field('resim'); ?>"/></a>
<a href="<?php the_field('pdf'); ?>" target="_blank"><h2><?php the_title(); ?></h2></a>
<p><?php echo kisalt($post->post_content, 150); ?>...</p>

<a href="<?php the_field('pdf'); ?>" target="_blank" class="pdf">PDF</a>
<a href="<?php the_field('solidworks'); ?>" target="_blank" class="solidworks">Solid</a>
</div>';
}
else
{
echo'
<div class="arsiv">
<a href="<?php the_field('pdf'); ?>" target="_blank"><img src="<?php the_field('resim'); ?>"/></a>
<a href="<?php the_field('pdf'); ?>" target="_blank"><h2><?php the_title(); ?></h2></a>
<p><?php echo kisalt($post->post_content, 150); ?>...</p>
</div>';
}
?>


Bu sorunu nasıl aşabilirim.
sanırım hem echo' '; hemde <?php the_field('pdf'); ?> burda tek tırnak kullandığım için oluyor.

 

ya su sekilde

echo "bla bla bla" . the_field('pdf') . "bla bla bla";

ya da

else
{
?>
<div class="arsiv">
<a href="<?php the_field('pdf'); ?>" target="_blank"><img src="<?php the_field('resim'); ?>"/></a>
<a href="<?php the_field('pdf'); ?>" target="_blank"><h2><?php the_title(); ?></h2></a>
<p><?php echo kisalt($post->post_content, 150); ?>...</p>
</div>
<?php
}

the_field() fonksiyonunun echo ile cikti verdigini farzettim yazarken. eger cikti vermiyor sadece return ediyorsa "echo the_field()" seklinde kullanman gerekecektir.

fader

En temiz çözüm

echo <<<END
text...
text
text
END

zombi

echo'<div class="arsiv">';
echo'<a href="'; <?php the_field('pdf'); ?>
echo'" target="_blank"><img src="';
<?php the_field('resim'); ?>echo'"/></a>
';

böyle yaptım ama yine olmadı

xxfastboy

php tagi içinde php tagi açmaya çalışıyorsun ondan olmuyor:

echo'<div class="arsiv">';
echo'<a href="';
echo the_field('pdf');
echo'" target="_blank"><img src="';
echo the_field('resim');
echo'"/></a>';

katukatu
1

mobil görünümden çık