@gjorgjievski looks really good! Thank you for sharing your work for other peoples! I guess, this question is solved!
@matteo-websolution okay. I thought my post is so old (august 2018), there was no extra forum for gutenberg and gutenberg was a plugin at this time.
@matteo-websolution Are you talking to me? If not, then you should contact ACF or open a new topic.
Here is the last release info:
https://www.advancedcustomfields.com/blog/acf-5-7-9-release/
recently I got the following tip from a user on the wordpress forum:
https://wordpress.org/support/forum-user-guide/faq/#i-have-the-same-problem-can-i-just-reply-to-someone-elses-post-with-me-too
I don’t know if you’ve found a solution. I will write my solution here, because your Topic is well ranked by Google and here no answer is written.
An here comes my solution.
paste preg_replace:
preg_replace('~<iframe[^>]*\K(?=src)~i','data-',$iframe);
Full Snippet:
<?php
// get iframe HTML
$iframe = get_field('oembed');
// use preg_match to find iframe src
preg_match('/src="(.+?)"/', $iframe, $matches);
$src = $matches[1];
// add extra params to iframe src
$params = array(
'controls' => 0,
'hd' => 1,
'autohide' => 1
);
$new_src = add_query_arg($params, $src);
$iframe = str_replace($src, $new_src, $iframe);
// add extra attributes to iframe html
$attributes = 'frameborder="0" class="lazyload"';
// use preg_replace to change iframe src to data-src
$iframe = preg_replace('~<iframe[^>]*\K(?=src)~i','data-',$iframe);
$iframe = str_replace('></iframe>', ' ' . $attributes . '></iframe>', $iframe);
// echo $iframe
echo $iframe;
?>
John, thank you very much for your explanation!
Thanks John. This was very helpful. Now I get related cpt posts without Errors or Warnings.
What do you mean by that?
Is
$meta_query
already defined before this line?
Should I have defined this more clearly?
// get meta query
$meta_query = $query->get('meta_query');
It’s crazy. I emptied the cache today. Now everything is fine.
Same with me. But only if I look at the backend with Firefox. The headers of the Metaboxes (acf-postbox), that are not intended for the page are visible.
In Chrome everything is good.
Okay I read this article and I think I just have to wait a litle bit. ๐
https://www.advancedcustomfields.com/blog/the-state-of-acf-in-a-gutenberg-world/
is this more a backend thing?
Sorry no. I thought my customer probably didn’t need it at all.
I think from today’s view I would solve it with Javascript. Find the child field and copy & paste in the repeater title. Or something like that.
/adding-custom-javascript-fields/
Since 5.7:
/resources/javascript-api/
Best
Matthias
Which plugins are in used? Is the plugin WPML activated?
And for FE, do you look at the page in preview mode or after saving the changes?
I found this smart solution for functions.php:
function showBeforeMore($fullText){
if(@strpos($fullText, '<!--more-->')){
$morePos = strpos($fullText, '<!--more-->');
print substr($fullText,0,$morePos);
print "<span class=\"read-more\"><a href=\"". get_permalink() . "\" class=\"read-more-link\">Read More</a></span>";
} else {
print $fullText;
}
}
<?php showBeforeMore(get_field('YOUR-FIELD-NAME')); ?>
my goal for Wysiwyg Editor with <!โmoreโ> was to integrate a toggle read-more/less-button:
function readmore($fullText){
if(@strpos($fullText, '<!--more-->')){
$morePos = strpos($fullText, '<!--more-->');
$fullText = preg_replace('/<!--(.|\s)*?-->/', '', $fullText);
print substr($fullText,0,$morePos);
print "<div class=\"read-more-content hide\">". substr($fullText,$morePos,-1) . "</div>";
print "<a class=\"ui lined small button read-more\">Read More</a>";
} else {
print $fullText;
}
}
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.