Placing the loop in a separate php file
-
I am developing a theme that has several different loops on each page (eg latest case studies, latest news, and the standard page content), this isn’t a problem, however as there are 12 different templates I want to either use a shortcode or the php include function in order to take the content from a 3rd party location (was thinking the functions.php file perhaps?)
How should I go about doing this?
Here is the HTML / PHP code I want to easily replicate:
‘<div class=”case_study_menu”>
<div class=”middle_box_text”>
<div class=”case_study_header”>
<h2>Case Studies</h2>
</div><?php rewind_posts(); ?>
<?php query_posts(‘category_name=roofing-case-study&posts_per_page=3’); ?>
<?php while (have_posts()) : the_post(); ?><div class=”case_study_exerpts”>
<div class=”case_study_exerpt”>
<h3>” class=”h3_a”><?php the_title(); ?></h3>
<p><?php the_advanced_excerpt(‘length=90&use_words=0&no_custom=1’) ?></p>
</div><?php endwhile; else: ?>
<?php endif; ?>
</div>
</div>
</div>
‘
- The topic ‘Placing the loop in a separate php file’ is closed to new replies.