So basically what I do now is wrap the code into this instead:
<?php $pistkarta = new WP_Query( array( 'page_id' => 73, 'showposts' => -1 ));
while ( $pistkarta->have_posts() ) : $pistkarta->the_post(); ?>
/* Content here from page with ID 73 */
<?php endwhile; ?>
Jeppe
Also I forgot to mention that it was a page, not a post, outputing the data. But should that really matter? Can you treat a page like a post and retrieve data from one page and output it in another?
Cheers
/Jeppe
Omg! I’m such a douche. I totally forgot to put in the standard loop.
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<?php endwhile; ?>
I wrapped the whole page in it and everything works again. I’m so sorry for this 🙂 I can’t believe I didn’t see that and wasted your time.
Regards / Jeppe
Hello again. A guy at my hosting company tried around a bit and came to the conclusion that if you put the post ID in the has_sub_filed();/the_sub_field(); the data shows. Like it doesn’t know where it is assigned to?
Like this (the “73”):
<?php while(has_sub_field("segment_servicepriser", 73)): ?> <h3><?php the_sub_field('segmentrubrik', 73); ?></h3> <ul class="artikel bigbox list">
<?php while(has_sub_field('artikel', 73)): ?>
<li>
<ul>
<li class="con60"> <?php if(get_sub_field('namn', 73)){ echo the_sub_field('namn', 73); } else { echo '-||-'; }?> </li> <li class="con20 right"><?php the_sub_field('pris'); ?>:-</li> <li class="con20 info right"><?php the_sub_field('info'); ?></li> </ul>
And so on… The 73 is the current ID of one of the pages spitting this date out. So if I want the same data to spit out somwhere else I have to put that ID in too.
I can’t recall that this was an issue before?
What do you think?
thanks again
regards / Jeppe
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.