Adding Custom Fields To ListGo

Adding Custom Fields To ListGo

From ListGo 1.2.6, You can add your custom fields to the single Listing and Add Listing page.

In this tutorial, I will show you how to do that.

I. Installing Advanced Custom Fields (ACF) plugin

From the admin sidebar, please click on Plugins -> Add New  -> Search for “Advanced Custom Fields” plugin.

 

II. Activating ListGo Child theme

From the admin sidebar, please click on Appearance -> Themes -> Activating ListGo Child. We never modify anything in the parent theme.

 

III. Adding a new field with ACF

Once this plugin is activated, you will see Custom Fields Menu on your admin bar like this

and click on + Add Field to add your custom field.

 

Now navigate to Listings -> Add New -> You will see “Test” field in this area

To echo “Test” value on the front end, We use get_field() function, you can also find lots of AFC functions at https://www.advancedcustomfields.com/resources/

For example: I will print the Test’s value to under the listing content by using ListGo  by using ListGo child theme.

add_action('wiloke/listgo/templates/single-listing/after_listing_content_open', 'listgoRenderTestValue');

function listgoRenderTestValue(){
   echo get_field('test');
}
  1. wiloke/listgo/templates/single-listing/after_listing_content_open: a ListGo’s hook ( I will described all hooks below)
  2.  test: this is field name that you created in the “Add Field” step

IV. Printing Custom Field to My own tab

Okay, In the below example  We printed Custom Field to under Listing Content (Description tab), but in case I want to print the custom field value to my own tab, how to do that?

1. Adding a custom tab to Single Listing

 

V. Adding Custom Fields To Add Listing Page

 

VI. List Of Hooks

1. wiloke/listgo/templates/single-listing/top_nav_tab

2. wiloke/listgo/templates/single-listing/bottom_nav_tab

4. wiloke/listgo/templates/single-listing/after_open_content, wiloke/listgo/templates/single-listing/before_tab-description_close

5. wiloke/listgo/templates/single-listing/render_custom_tab_content

Using this hook combines with wiloke/listgo/templates/single-listing/bottom_nav_tab or wiloke/listgo/templates/single-listing/top_nav_tab to create a new tab and new custom content area as the example.

NEWSLETTERS

Subscribe to our email list and stay up-to-date with all our awesome releases and latest updates.
MailChimp Icon