Support

Account

Forum Replies Created

  • Thank you! I get it now and managed to solve it thanks to you 🙂

  • Alright, I did some more tampering and removed the include() and put the same code there like this:

    <?php elseif( get_row_layout() == 'apartmentlayout' ): ?>
    			<?php $featured_posts = get_sub_field('apartmentlink');
    			if( $featured_posts ): ?>
    				<ul>
    					<?php foreach( $featured_posts as $post ): 
    						setup_postdata($post); ?>
    			      <li>
    			          <?php the_title(); ?>
    			          <?php if( have_rows('apartment') ): ?>
    			  					<?php while( have_rows('repeater_field_name') ) : the_row(); ?>
    			  						<?php the_sub_field('number'); ?>			
    			  					<?php endwhile; ?>
    							<?php endif; ?>
    			      </li>
    			  	<?php endforeach; ?>
    			    </ul>
    				<?php wp_reset_postdata(); ?>
    			<?php endif; ?>
    
    		<?php endif; ?>

    I still get the same issue with 24 titles after eachother with the title from the current post I’m at.

    So I tried this:

    <?php elseif( get_row_layout() == 'apartmentlayout' ): ?>
    			<?php echo '<pre>';
        		print_r( get_sub_field('apartmentlink')  );
    			echo '</pre>';
    			die; ?>
    
    		<?php endif; ?>

    And that on the other hand returns the correct post like this:

    WP_Post Object
    (
        [ID] => 73284
        [post_author] => 11
        [post_date] => 2022-09-19 08:39:19
        [post_date_gmt] => 2022-09-19 06:39:19
        [post_content] => 
        [post_title] => Content 1
        [post_excerpt] => 
        [post_status] => publish
        [comment_status] => closed
        [ping_status] => closed
        [post_password] => 
        [post_name] => content-1
        [to_ping] => 
        [pinged] => 
        [post_modified] => 2022-09-19 08:54:00
        [post_modified_gmt] => 2022-09-19 06:54:00
        [post_content_filtered] => 
        [post_parent] => 0
        [guid] => //localhost:3000/?post_type=apartments&p=73284
        [menu_order] => 0
        [post_type] => apartments
        [post_mime_type] => 
        [comment_count] => 0
        [filter] => raw
    )

    So it doesn’t seem to work even without include

  • Alright, well I’m running roots / sage which shouldn’t make much difference.

    I have a template for the “Project” posts which looks like this:

    {{--
      Template Name: Projekt
    --}}
    
    @extends('layouts.app')
    
    @section('content')
      @while(have_posts()) @php the_post() @endphp
        @include('partials.content-projekt')
      @endwhile
    @endsection
    

    And then I have content-single-projekt page which takes care of the flexible content and it looks like this:

    @include('partials/section-hero')
    
    @include('partials/section-intro')
    
    <?php if( have_rows('content') ): ?>
    	<?php while( have_rows('content') ): the_row(); ?>
        
    		<?php if( get_row_layout() == 'projectfacts' ): ?>
    			<h1>stuff here</h1>
    
    		<?php elseif( get_row_layout() == 'apartmentlayout' ): ?>
    			@include('partials/section-apartment')
    
    		<?php endif; ?>
    	<?php endwhile; ?>
    <?php endif; ?>

    And lastly my section-apartment looks like the example up top.

  • Thank you very much for your informative thoughts! Glad to see I’m not alone in this. Fortunately my client hasn’t (yet) complicated things further. But interesting to see what different ideas you’ve tried, the last one I thought about as well but unfortunately I don’t have the time nor the budget.

    But thanks to your message I came to think of another way to go which is a little bit different design-wise but I think it will work rather well. I will just load all posts and only show the ones with a date past today (or maybe a few days back as well). And then I will use Ajax to filter between older posts and newer posts based on dates. It’s just a thought right now but I’m guessing it might be able to work.

    I’m afraid it might not help you though 🙁

Viewing 5 posts - 1 through 5 (of 5 total)