Home › Forums › Front-end Issues › Something wrong…
Hi! i’m not an expert.. what’s is wrong with this part of code?
I put in bold the slug of the field i need to display..
$items .= “<div class=’av-masonry-entry-content entry-content’>”;
$items .= “the_field(‘artist)”;
$items .= “</div>”;
I need also to add a conditional statements for this field!
Any suggestions!?
Looks like you are missing the closing single quote on ‘artist’
try this in 1 line
<?php
$items = “<div class=\”av-masonry-entry-content entry-content\”>”.the_field(‘artist’);”</div>”;
?>
nothing…
i show u the complete part of code.. i would to replace the part in bold (&content) with 3 custom field i’ve insert for a portfolio item..
//title and excerpt
if($this->atts[‘caption_elements’] != ‘none’ || !empty($text_add))
{
$items .= “<figcaption class=’av-inner-masonry-content site-background’><div class=’av-inner-masonry-content-pos’><div class=’avia-arrow’></div>”.$text_before;
if(strpos($this->atts[‘caption_elements’], ‘title’) !== false){
$items .= “<h3 class=’av-masonry-entry-title entry-title’>{$the_title}</h3>”;
}
if(strpos($this->atts[‘caption_elements’], ‘excerpt’) !== false && !empty($content)){
$items .= “<div class=’av-masonry-entry-content entry-content’>{$content}</div>”;
}
$items .= $text_after.”</div></figcaption>”;
}
$items .= “</figure>”;
$items .= “</{$html_tags[1]}><!–end av-masonry entry–>”;
}
thx!
To reply to your first question. There is an issue with your code.
Please change:
$items .= “the_field(‘artist)”;
to
$items .= get_field('artist');
The topic ‘Something wrong…’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.