Ich habe zwei Seiten erstellt, eine Titelseite und eine “Grundlegende Inhaltsseite”.
Auf dieser “Basisinhaltsseite” habe ich einen flexiblen Inhalt mit verschiedenen Texten und Bildern erstellt.
Ich suche nach einer Möglichkeit, die anzuzeigen letzte Reihe auf der Titelseite, ist das möglich?
UPDATE: Hier ist der letzte Code, der dank @Nick Surmanidze den Inhalt von einer anderen Seite mit “Post-Objektfeld” (mit dem Namen “Relation”) abrufen kann. Bleibt nur noch die Frage, wie man die letzte Reihe ergreift.
<?php
$post_object = get_field('relation');
if( $post_object ):
// override $post
$post = $post_object;
setup_postdata( $post );
?>
<div>
<?php
// check if the flexible content field has rows of data
if( have_rows('selection') ):
// loop through the rows of data
while ( have_rows('selection') ) :
the_row();
if( get_row_layout() == 'selectionselection' ):
?>
<div class="titre-soustitre">
<div class="menu-content" data-id="id-<?php the_sub_field('id'); ?>">
<p class="demo bis"><span class="sub"> </span></p>
<a href="#" class="expander"><h1><p class="demo title"><?php the_sub_field('title'); ?></p></h1></a>
<p class="demo bis"><span class="sub"><?php the_sub_field('subhead'); ?></span></p>
</div>
</div>
<?php
endif;
endwhile; else :
// no layouts found
endif;
?>
</div>
<?php wp_reset_postdata();// IMPORTANT - reset the $post object so the rest of the page works correctly ?>
<?php endif; ?>
UPDATE 2: Um Ihnen beim Verständnis zu helfen: Hier ist die ZEILE der anderen Seite, die ich durch $post_object ergreife
<?php
// check if the flexible content field has rows of data
if( have_rows('selection') ):
// loop through the rows of data
while ( have_rows('selection') ) : the_row();
if( get_row_layout() == 'selectionselection' ):?>
<div class="titre-soustitre">
<div class="menu-content" data-id="id-<?php the_sub_field('id');?>">
<p class="demo bis"><span class="sub"> </span></p>
<a href="#" class="expander"><h1><p class="demo title"><?php the_sub_field('title');?></p></h1></a>
<p class="demo bis"><span class="sub"><?php the_sub_field('subhead');?></span></p>
</div>
</div>
<?php endif;
endwhile;
else :
// no layouts found
endif;
?>