Hey John thanks for your reply and the inspiration!
In the mean while I found another solution that works:
The maximum number of columns in my side are 3… So I made the code above with three layouts.
And added some if statemens. In them I used the bootstrap hide- classes. They make the content display: none.
The if statements look like this:
` $width = get_sub_field(‘column_width’);
$col_size_left = ‘col-lg-6 col-md-6 col-sm-6 col-xs-12’;
$col_size_right = ‘col-lg-6 col-md-6 col-sm-6 col-xs-12’;
if($width == ‘6-6’):
$col_size_left = ‘col-lg-6 col-md-6 col-sm-6 col-xs-12’;
$col_size_middle = ‘hidden-xs hidden-sm hidden-md hidden-lg’;
$col_size_right = ‘col-lg-6 col-md-6 col-sm-6 col-xs-12’;
elseif($width == ‘5-7’):
$col_size_left = ‘col-lg-5 col-md-5 col-sm-5 col-xs-12’;
$col_size_middle = ‘hidden-xs hidden-sm hidden-md hidden-lg’;
$col_size_right = ‘col-lg-7 col-md-7 col-sm-7 col-xs-12’;
elseif($width == ‘7-5’):
$col_size_left = ‘col-lg-7 col-md-7 col-sm-7 col-xs-12’;
$col_size_middle = ‘hidden-xs hidden-sm hidden-md hidden-lg’;
$col_size_right = ‘col-lg-5 col-md-5 col-sm-5 col-xs-12’;
elseif($width == ‘4-8’):
$col_size_left = ‘col-lg-4 col-md-4 col-sm-4 col-xs-12’;
$col_size_middle = ‘hidden-xs hidden-sm hidden-md hidden-lg’;
$col_size_right = ‘col-lg-8 col-md-8 col-sm-8 col-xs-12’;
elseif($width == ‘8-4’):
$col_size_left = ‘col-lg-8 col-md-8 col-sm-8 col-xs-12’;
$col_size_middle = ‘hidden-xs hidden-sm hidden-md hidden-lg’;
$col_size_right = ‘col-lg-4 col-md-4 col-sm-4 col-xs-12’;
elseif($width == ‘4-4-4’):
$col_size_left = ‘col-lg-4 col-md-4 col-sm-4 col-xs-12’;
$col_size_middle = ‘col-lg-4 col-md-4 col-sm-4 col-xs-12’;
$col_size_right = ‘col-lg-4 col-md-4 col-sm-4 col-xs-12’;
elseif($width == ‘1’):
$col_size_left = ‘col-lg-12 col-md-12 col-sm-12 col-xs-12’;
$col_size_middle = ‘hidden-xs hidden-sm hidden-md hidden-lg’;
$col_size_right = ‘hidden-xs hidden-sm hidden-md hidden-lg’;
endif; `
Hello Matt,
It is possible and very very easy. There is a WP Plugin called “Duplicate Post”. You can clone posts and pages with it.
I use it a lot and it works perfect.
Wohoo! Thanks it works! I’ll style it a little bit and than post it here so others can use it as a template…
Hm, realy strange…
Something must be wrong with the } it gives me syntax error for those…
Are you from Germany by the way?
That would be very nice 🙂
Hello Mediawerk! Thanks for your reply.
I use flexible content fields because I actually want both image and text be optional an later als add other options.
I just tryed your code and it gives me some syntax error and missing expected ;
Sorry but my PHP skills are not that good yet so I can see the mistakes immidiately.
Hello John!
Thanks for your quick reply! I just changed
if( have_rows('reihe') ):
to
if( have_rows('linke_spalte') ):
but unfortunately this doesn’t work eather either. The code I posted at least shows the content of linke_spalte
but not the content of rechte_spalte
.
What I actually miss my self in my markup is the following:
In row 4 I am asking for if( get_row_layout() == 'reihe' ):
For me that seems to be correct because this is the parent flexible content. But later in the code there is no
if( get_row_layout() == 'linke_spalte' ):
or
if( get_row_layout() == 'rechte_spalte' ):
for children flexible content
…
Is this maybe the mistake? In case what is the right markup for it?
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.