Directory Plugin - how to customize

Hi,

Is it possible to add custom fields and have them be available to certain categories only?

Example:
Under restaurants I would want to show
price range and food type but under Veteranarians, i would want to show what services they provide.

Thanks,
Al

  • Tom Eagles

    Hi there @AL

    I am not sure if this is in fact possible without some customisation, please hang on and I will get back to you with an answer from our developer @Arnold as to if its possible and what would need doing.

    In theory it shouldn't be that difficult but before i give a definitive answer i need to check through the code and bounce my ideas off the dev, So please be patient as this may take a bit longer than a normal support question.

    Kindest Regards

    Tom

  • Arnold

    You would have to change the custom field display portion and write your own. There is some support for what your doing in the CustomPress shortcodes for displaying custom fields.

    Used to restrict the list of fields returned depending on the categories of the post. Multiple [ct_filter] shortcodes may be added to a [custom_field_input] or [custom_field_block] shortcode.
    [ct_filter terms="cat1, cat2,.."] _ct_selectbox_4cf582bd61fa4, _ct_text_4cfeb3eac6f1f,... [/ct_filter]
    terms= Comma separated category list to filter on. Categories not associated with the post type of the current post will be ignored.
    The comma separated list of fields between the opening and closing tags will be returned if the categories match. Fields not associated with the post type of the current post will be ignored.

  • AL

    Ok, so the good news is that it's possible, the bad news is i have no clue how to do what you've suggested :slight_smile: without a step by step tutorial or demo. I will keep at it and if there is any document you can point me to to I would really appreciate it Arnold.

    I'm loving this plugin and primarily why i became a member of this great community. The second reason was bookings plugin.

    Let me know if you have newbie instructions and i'll give it a go.

    Thanks in advance,
    Al

  • Arnold

    Well briefly.

    In the template for a single-listing there is a shortcode

    [custom_fields_block wrap="table"][/custom_fields_block]

    that is used to display all the custom fields of a given post. You can add a filter shortcode to that

    [custom_fields_block wrap="table"][ct_filter terms="veterinarian"] _ct_selectbox_4cf582bd61fa4, _ct_text_4cfeb3eac6f1f[/ct_filter] [/custom_fields_block]

    Which would only display the two filter fields enclosed if the category was "veterinarian"
    You can put multiple filters in the block to filter for different categories.

  • AL

    Hi Arnold,

    As mentioned previously, the above instructions are above my "current" capabilities. But the good news is, if a custom field is not populated, it doesn't show up on the listing which is fantastic. This way, if i'm working on a restaurant listing, i populate price, and when i'm creating a listing for vets, then only the one's i add values to show up. So i think for now i'm good.

    Thanks for your help. I will be posting another message about directory in a bit, looking forward to your help again.

    Thanks,
    Al

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.