Getting the “Original” Post ID using the POST field
-
Hi,
Fantastic Plugin, thanks, has helped me out massively!!I’m using a Reapeater field along with the Post Field (as a Sub-field) to display a list of Custom Post typeson any page. It works fantastically, however Im having a problem getting the custom Post types “original” ID and disaplying it.
the code below now works, but its a bit clumsy, does anyone know if there is a better way of doing it?, get_the_ID & the_Id wont work at all.
Many thanks in advance, Mark
<div class="testimonials patient-story cf"> <?php if ( block_rows( 'cutic-patient-stories' ) ): ?> <?php while ( block_rows( 'cutic-patient-stories' ) ) : ?> <?php block_row( 'cutic-patient-stories' ); ?> <div style="display:none"><!-- Hide this as it displays the title, I just want to use it, not display it. $echo = false returns a STRING error --> <?php $mypost = get_page_by_title( block_sub_field( 'select-a-patient-story' ), '', 'patient_stories' ); //echo $mypost->ID; ?> </div> <article id="post-<?php echo $mypost->ID;; ?>" class="cc_testimonial m-all t-all d-all"> <?php //$mytitle = block_sub_field( 'select-a-patient-story', $echo = false ); ?> <?php //echo $mytitle; ?> <blockquote> <p><?php echo limit_words(get_the_excerpt(block_sub_value( 'select-a-patient-story' )->ID), '55'); ?></p> </blockquote> <p class="author"> <?php block_sub_field( 'select-a-patient-story' ); ?> <span class="readmore"><a class="" href="<?php echo get_post_type_archive_link( 'patient_stories' ); ?>" title="read more patient stories">Read more stories</a></span></p> </article> <?php endwhile; ?> <?php endif; ?> <?php reset_block_rows( 'cutic-patient-stories' ); ?> </div>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Getting the “Original” Post ID using the POST field’ is closed to new replies.