The listing results in BePro Listings are built via a dynamic template system. This makes it super easy to create your own if you are a php developer. This level of customization is an intermediate level job.

WE CAN DO IT

If you know what you want but don’t know how to code, then simply purchase 1hr of¬†wordpress Development

THE PROCESS

The process itself is fairly strait forward. A) You need a template file with wordpress hooks. B) You need a list of functions which are fired when your template file is called C) You need a css stylesheet that will be loaded with your template. Here is an example of our template in templates/listings/generic_1.php

<div class="shortcode_results_2"><!--?php
do_action( 'bepro_listings_list_above_title', $result );
do_action( 'bepro_listings_list_title', $result);
do_action( 'bepro_listings_list_below_title', $result);
do_action( 'bepro_listings_list_above_image', $result);
do_action( 'bepro_listings_list_image', $result);
do_action( 'bepro_listings_list_after_image', $result);
do_action("bepro_listings_list_content", $result);
do_action("bepro_listings_list_end", $result);
?-->
<div style="clear: both;"></div>
</div>

You will notice our template file is as simple as it comes. A few html declarations for our stylesheet to focus on and the wordpress action hooks. That’s it, like we said, easy.

THE FUNCTIONS

Once you have the template file, you have figured out the hardest part. All you need to do now, is tell us, which functions to fire for each of the action hooks in your template file. Of course, they are your functions, so they will show whatever you want when they are called.

$data = get_option("bepro_listings");
$data['bepro_listings_list_template_2'] = array(
"bepro_listings_list_title" => "bepro_listings_list_title_template",
"bepro_listings_list_below_title" => "bepro_listings_list_category_template",
"bepro_listings_list_above_title" => "bepro_listings_list_image_template",
"bepro_listings_list_image" => "bepro_listings_list_geo_template",
"bepro_listings_list_content" => "bepro_listings_list_content_template",
"bepro_listings_list_end" => "bepro_listings_list_links_template",
"style" => plugins_url("css/generic_listings_2.css", __FILE__ ),
"template_file" => plugin_dir_path( __FILE__ ).'/templates/listings/generic_1.php');
update_option("bepro_listings", $data);

So there you have it. Give your template a number, it obviously cannot be 1 or 2. It can however be whatever characters you want it to be. Don’t try spaces. For an example, your template can be called, bepro_listings_list_template_greatestPluginsTemplateEver, in which case, your declaration would start like this

$data['bepro_listings_list_template_greatestPluginsTemplateEver'] = array(...

Which would result in a shortcode looking like,

[display_listings type="greatestPluginsTemplateEver"]

For the rest of the array, on the left you have the hook that’s in your template file. On the right, you have the function you want called. The last 2 options are the css stylesheet and the template file. Neither are mandatory; However, if you are going to use them, simply tell us where the files are.

CONCLUSION

We are working on ways to make this a drag and drop solution. However, for now, creating a new template for BePro Listings is a job for a novice developer. If you would like to create your own templates for BePro Listings, its as easy as A, B, C.


Date: Custom Listing Templates was last modified: October 4th, 2014 by BePro Software Team Management at BeProSoftware.com

4 thoughts on “Custom Listing Templates

  1. testit1

    The Functions – Line11 – the ) is not neccessary

  2. sonialiju123

    Can You tell where this template file should be saved?

Leave a Reply