skip to Main Content
< All Articles
Print

How to customize the Property Page?

This quick tutorial will guide you to customize the Single Property Page according to your theme’s design. We will take the Twenty Nineteen Theme as an example here.

First, you have to make a duplicate of the page.php file. Go to your theme files using FTP or Control Panel (in our case it’s inside wp-content/themes/twentynineteen). Create a file named single-rem_property.php and put the inner contents of the page.php file there.

Now you have to load this file instead of the default Property Template. For this, go to Settings -> Template Settings -> Property Page Template and choose From Theme. Then previewing the property page you will only see the contents. So, we have to integrate the property contents also (eg: meta).

Open the single-rem_property.php file in a text editor and you will see the following code

<?php
/**
 * The template for displaying all single posts
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
 *
 * @package WordPress
 * @subpackage Twenty_Nineteen
 * @since 1.0.0
 */

get_header();
?>

	<section id="primary" class="content-area">
		<main id="main" class="site-main">

			<?php

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

				get_template_part( 'template-parts/content/content', 'page' );

				// If comments are open or we have at least one comment, load up the comment template.
				if ( comments_open() || get_comments_number() ) {
					comments_template();
				}

			endwhile; // End of the loop.
			?>

		</main><!-- #main -->
	</section><!-- #primary -->

<?php
get_footer();

We will make the changes inside the loop.

Suppose you want to display the property type, you will use the function rem_get_field_value for getting the data. In our case, property type field has a data name as property_type so our code will become

<?php
/**
 * The template for displaying all single posts
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
 *
 * @package WordPress
 * @subpackage Twenty_Nineteen
 * @since 1.0.0
 */

get_header();
?>

	<section id="primary" class="content-area">
		<main id="main" class="site-main">

			<?php

			/* Start the Loop */
			while ( have_posts() ) :
				the_post(); ?>
				<div class="entry-content ich-settings-main-wrap">
					<?php echo rem_get_field_value( 'property_type' ); ?>
				</div>
			<?php endwhile; // End of the loop.
			?>

		</main><!-- #main -->
	</section><!-- #primary -->

<?php
get_footer();

Similarly, you can get any field’s data.

The Following hooks can also be used to display the default listing page.

<?php
/**
 * The template for displaying all single posts
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
 *
 * @package WordPress
 * @subpackage Twenty_Nineteen
 * @since 1.0.0
 */

get_header();
?>

	<section id="primary" class="content-area">
		<main id="main" class="site-main">

			<?php

			/* Start the Loop */
			while ( have_posts() ) :
				the_post(); ?>
				<div class="entry-content ich-settings-main-wrap">
			             <?php
					/**
					 * Hook: rem_single_property_page_slider.
					 */
					do_action( 'rem_single_property_page_slider', get_the_id() );

					/**
					 * Hook: rem_single_property_page_title.
					 */
					do_action( 'rem_single_property_page_title', get_the_id() );

					/**
					 * Hook: rem_single_property_page_contents.
					 */
					do_action( 'rem_single_property_page_contents', get_the_id() );

					/**
					 * Hook: rem_single_property_page_contents.
					 */
					do_action( 'rem_single_property_page_childs', get_the_id() );

					/**
					 * Hook: rem_single_property_page_sections.
					 */
					do_action( 'rem_single_property_page_sections', get_the_id() );

					/**
					 * Hook: rem_single_property_page_features.
					 */
					do_action( 'rem_single_property_page_features', get_the_id() );

					/**
					 * Hook: rem_single_property_page_map.
					 */
					do_action( 'rem_single_property_page_map', get_the_id() );

					/**
					 * Hook: rem_single_property_page_tags.
					 */
					do_action( 'rem_single_property_page_tags', get_the_id() );

					/**
					 * Hook: rem_single_property_page_edit.
					 */
					do_action( 'rem_single_property_page_edit', get_the_id() );
				     ?>
				</div>
			<?php endwhile; // End of the loop.
			?>

		</main><!-- #main -->
	</section><!-- #primary -->

<?php
get_footer();

 

Quick Navigation
Back To Top