Ahh, now I get it. Thank you very much.
Oh, I’m sorry, I was thinking of something completely different. I thought I should create the images as a background and then display them via the media queries 🙂 Of course, your method is also a good option that I will use. Thank you very much.
By media queries do you mean the usage in css (like @media (min-width: 586px))? Unfortunately, that doesn’t work because the user should be able to upload their own images in the backend.
Yes, I use Bootstrap and use it as it is in the instructions for the <picture> tag. What do you mean by the display utilities?
Yes, this works with just one image (I use nearly the same way with headerbild_desktop), but in my <picture> element I have 3 images. I would like the caption of the image that is currently displayed. I need an instruction under credits, which outputs exactly the caption of the displayed image.
Hello @ChrisDark,
Thank you for your answer and a list of the many possibilities. The HTML solution is unfortunately out of the question for me, because I want to use my invited images as background images.
I tried the PHP solution, but unfortunately without any result. Where do I have to place the source code? After “backround-image: url (“? I looked a little bit on the Internet. I read that the method can cause problems with caching tools.
I like your last variant best, but I didn’t get that to work either 🙂
How and where can I place a or the data attr? I am grateful to you for any help.
Best regards
Arnim
Ok, I found I simple solution for the problem:
<?php
$args = array(
'category_name' => 'kampagne-2020',
'post_type' => 'post',
'posts_per_page' => 3,
'orderby' => 'rand'
);
$custom_query = new WP_Query($args);
if ($custom_query->have_posts()) : while($custom_query->have_posts()) : $custom_query->the_post(); ?>
Thank you very much, that solved my problem.
I would like to have checked via php whether the fields in the repeater field are empty. If so, the empty source code for the field should not appear on the website. For individual fields it is possible for me.
Example:
<?php if( get_field('beschreibung') ): ?>
<?php the_field('beschreibung'); ?>
<?php endif; ?>
How do I do this on repetitions?
Sorry for my late answer! It is both. It is the name of the repeater and a sub field in the repeater.
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.