March 9, 2013 at 10:41 pm #21069
In my loop-page.php file I have this code which allows a little flag with a picture of an orange in it appear to the left of the content (it mimics the date flag on blog posts –example: http://www.outtacontext.com/wp2/about/jeffs-present/)
<div class="one unit alpha blog-meta">
<div class='side-container side-container-date side-visible'>
<img src="http://outtacontext.com/wp2/wp-content/themes/sentence/images/layout/orange_left.png" alt="Orange" border="0">
<!-- <span class='date-day'><?php the_time('d') ?></span>
<span class='date-month'><?php the_time('M') ?></span>
</div><!--end meta info-->
I have another template which is based on this template but I want another image to appear in the black flag area for just this one template. I want to create a different loop-page file with this new image replacing the orange. I see this call to the loop-page.php file in the original template:
$avia_config['size'] = 'page';
get_template_part( 'includes/loop', 'page' );
I figured this is the call to that page but I don’t understand the syntax well enough to create a second loop-page.php file with this new img tag in it. Say the new page is called loop-page-past.php, can you show me the code to call that new include in the template? Thx.March 10, 2013 at 2:11 pm #110332
Okay, I did an experiment and it seems to have worked. First, I created a new loop-page.php file and renamed it loop-page-past.php. Then I went into the template itself and changed the call to:
/* Run the loop to output the posts.
* If you want to overload this in a child theme then include a file
* called loop-page.php and that will be used instead.
$avia_config['size'] = 'page-past';
get_template_part( 'includes/loop', 'page-past' );
This worked. I just want to confirm that this is the right way to do it.March 11, 2013 at 2:34 pm #110333
Yes, that is correct. You can use get_template_part to grab any other file and include it in the space. See: http://codex.wordpress.org/Function_Reference/get_template_part
The topic ‘Different loop-page.php for one template’ is closed to new replies.