Creating property archive template

It is recommended to create a separate archive template for property rather than using theme default archive.php or index.php.

Step One – Locate theme file

You will need to locate theme archive.php or index.php which usually located in the root folder of your theme.

Step Two – Clone the file

After you have found the file as in step one, you will need to copy the file and use archive-property.php as the new filename.

Step Three – Change the loop

In the newly copied file, find the theme code for WordPress Loop, usually it is wrapped inside PHP while syntax.

Example loop code from WordPress twentytwelve theme :

 

			
			/* Start the Loop */
			while ( have_posts() ) : the_post();

				/* Include the post format-specific template for the content. If you want to
				 * this in a child theme then include a file called called content-___.php
				 * (where ___ is the post format) and that will be used instead.
				 */
				get_template_part( 'content', get_post_format() );

			endwhile;

			twentytwelve_content_nav( 'nav-below' );

 

Change the loop template into this code :

 

			
if (class_exists('VTCore_Wordpress_Utility')) {
  include VTCore_Wordpress_Utility::locateTemplate('property-loop.php');
}
Show All