Title: Load fields before the_post content
Last modified: August 31, 2016

---

# Load fields before the_post content

 *  Resolved [ludsonaiello](https://wordpress.org/support/users/ludsonaiello/)
 * (@ludsonaiello)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/load-fields-before-the_post-content/)
 * I’m trying to load the DB fields before the page content. I would like to change
   my default template including some BD fields. Would I like to load the fields
   in various parts of my template but can not find any documentation that would
   allow me to call a function to display a specific field.
 * I tried using the code below, but this function returns the shortcode [businessdirectory].
   I need to customize the way content is displayed, need to change the title of
   the page, I need to know how to call the functions outside the template plugin.
 * It’s possible?
 * [https://wordpress.org/plugins/business-directory-plugin/](https://wordpress.org/plugins/business-directory-plugin/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Business Directory Plugin](https://wordpress.org/support/users/businessdirectoryplugin/)
 * (@businessdirectoryplugin)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/load-fields-before-the_post-content/#post-7191566)
 * Hi ludsonaiello,
 * I’ll need to check with my developer about the details of loading. Some of what
   you want is contained in our customization guides:
 * We have 3 options for customizing the look of the directory.
 * 1) First is custom CSS to do basic tweaks like fonts, spacing and colors. Here
   is an article about how to use custom CSS with Business Directory in a way that
   doesn’t get overwritten on upgrade of BD: [http://businessdirectoryplugin.com/support-forum/faq/how-to-use-custom-styles-with-bd-2-1/](http://businessdirectoryplugin.com/support-forum/faq/how-to-use-custom-styles-with-bd-2-1/)
 * 2) For the more adventurous and layout-based changes, you can override templates:
   [http://businessdirectoryplugin.com/support-forum/faq/customizing-bd-to-fit-your-theme/](http://businessdirectoryplugin.com/support-forum/faq/customizing-bd-to-fit-your-theme/)
   And also do more with fields: [http://businessdirectoryplugin.com/support-forum/faq/advanced-customization-of-the-list-and-detail-views-of-bd/](http://businessdirectoryplugin.com/support-forum/faq/advanced-customization-of-the-list-and-detail-views-of-bd/)
 * 3) But if that’s not enough, you can go full-bore and customize anything in the
   plugin if you have the proper skill set: [http://businessdirectoryplugin.com/docs/customization-guide/](http://businessdirectoryplugin.com/docs/customization-guide/)
 *  Plugin Author [Business Directory Plugin](https://wordpress.org/support/users/businessdirectoryplugin/)
 * (@businessdirectoryplugin)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/load-fields-before-the_post-content/#post-7191710)
 * Hi ludsonaiello,
 * My developer responded:
 * _The customization guide ([http://businessdirectoryplugin.com/support-forum/faq/advanced-customization-of-the-list-and-detail-views-of-bd/](http://businessdirectoryplugin.com/support-forum/faq/advanced-customization-of-the-list-and-detail-views-of-bd/))
   is definitely the best place to go for info about displaying specific fields._
 * That being said, trying to do that before the content could be problematic because
   BD might not know (yet) the listing that is going to be displayed. That’s the
   result of dispatching everything from a shortcode and one of the things addressed
   in our next major release.
 * For now, a possible work-around might be something like the following:
 *     ```
       <?php
       // We need to create a function like this one.
       function current_listing() {
           global $wpbdp;
   
           if ( 'showlisting' != $wpbdp->controller->action )
               return 0;
   
           $id_or_slug = '';
           if ( get_query_var( 'listing' ) || isset( $_GET['listing'] ) )
               $id_or_slug = get_query_var( 'listing' ) ? get_query_var( 'listing' ) : wpbdp_getv( $_GET, 'listing', 0 );
           else
               $id_or_slug = get_query_var( 'id' ) ? get_query_var( 'id' ) : wpbdp_getv( $_GET, 'id', 0 );
           $listing_id = wpbdp_get_post_by_id_or_slug( $id_or_slug, 'id', 'id' );
   
           return $listing_id;
       }
   
       // Display or obtain the value from a specific field for the 'current' listing, as per
       // http://businessdirectoryplugin.com/support-forum/faq/advanced-customization-of-the-list-and-detail-views-of-bd/.
   
       $field = wpbdp_get_form_field( 4 );
       echo $field->display( current_listing() ); // This prints all HTML output for field with ID 4.
       echo $field->value( current_listing() ); // This prints just the value for the field with ID 4.
       ?>
       ```
   
 * I hope that helps. Please let me know if you have any other questions or issues!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Load fields before the_post content’ is closed to new replies.

 * ![](https://ps.w.org/business-directory-plugin/assets/icon-256x256.png?rev=2901888)
 * [Business Directory Plugin - Easy Listing Directories for WordPress](https://wordpress.org/plugins/business-directory-plugin/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/business-directory-plugin/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/business-directory-plugin/)
 * [Active Topics](https://wordpress.org/support/plugin/business-directory-plugin/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/business-directory-plugin/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/business-directory-plugin/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Business Directory Plugin](https://wordpress.org/support/users/businessdirectoryplugin/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/load-fields-before-the_post-content/#post-7191710)
 * Status: resolved