Free Directory, Listing & Classifieds WordPress Plugin Support General HivePress How to customize vendor template and custom attributes?

How to customize vendor template and custom attributes?

  • Author
    Posts
  • SpiralB

    Hi,

    Great theme! How can I customize the vendor template along with the display of custom attributes? I know I can use add_filter but that seems to add to the existing template structure. I’m looking to completely change it (not display the listings area) and possibly create my own blocks.

    Also, what code can I use within this custom block/template to retrieve and display a custom attribute for the vendor?

    Thanks!

    ihordeveloper

    Thanks!

    1. The best way to do this is via the “hivepress/v1/templates/…” filter, HivePress defines templates as a structure of blocks instead of HTML. It may be more confusing than just overriding and editing HTML, but allows to keep the backward compatibility, and there’s a planned full integration with Gutenberg (templates will be visually editable).

    If you want to change the vendor page completely please override this array via the “hivepress/v1/templates/vendor_view_page” filter https://github.com/hivepress/hivepress/blob/master/includes/templates/class-vendor-view-page.php If you keep its keys (e.g. “vendor_actions_primary”, “vendor_details_primary”…), then all third-party extensions will still work with your custom template.

    2. Please check how vendor attributes are displayed in this template part https://github.com/hivepress/hivepress/blob/master/templates/vendor/view/page/vendor-attributes-primary.php

    SpiralB

    Thanks for your help. I notice if I remove blocks from the array, they still display but if I replace the type and content within the filter, then that seems to help. Is this the only way by overriding the already existing blocks? There’s no way to remove them completely from the array?

    ihordeveloper

    You can remove blocks via “unset” like with any PHP array, if you unset some item and return the template array via a filter the block should be hidden, you can lookup the array structure here https://github.com/hivepress/hivepress/blob/master/includes/templates/class-vendor-view-page.php Also, you can completely override the template by replacing this array with a custom one (just by defining and returning a new array via a filter).

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

Subscribe

Sign In

Don't have an account? Register

Forgot password?

Register

Already have an account? Sign In

Forgot password?

Reset Password

Please enter your username or email address, you will receive a link to create a new password via email.