• Hi all,

    I’m creating a portfolio which needs to display and thumbnail, title and link to all other portfolio pages using a specific template.

    This is what I have so far, which manages to retrieve the page title and the featured image just fine. I’m struggling to retrieve the link to that page as the_permalink() just returns the link of the page you’re currently on.

    <?php foreach ( $builtins as $page ) : ?>
    			<div class="fw-col-xs-6 fw-col-md-3  remove-column-padding ">
    				<div class="casestudy">
    					<?php if (has_post_thumbnail( $page->ID ) ): ?>
    						<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $page->ID ), 'single-post-thumbnail' ); ?>
    						<div class="block" style="background: url('<?php echo $image[0]; ?>')">
    							<h3>
    								<a href="<?php echo apply_filters( 'the_permalink', $page->post_permalink, $page->ID ); ?>" title="<?php echo apply_filters( 'the_title', $page->post_title, $page->ID ); ?>">
    									<?php echo apply_filters( 'the_title', $page->post_title, $page->ID ); ?>
    									<span></span>
    								</a>
    							</h3>
    						</div>
    					<?php endif; ?>
    				</div>
    			</div>
    		<?php endforeach; ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Retrieve data from page using specific template’ is closed to new replies.