How to override map template

I tried to override this template : www/wp-content/plugins/hivepress-geolocation/includes/templates/class-listing-map-block.php

I add in the chide theme : www/wp-content/themes/renthalhive-child/plugins/hivepress-geolocation/includes/templates/class-listing-map-block.php

I also tried like this : www/wp-content/themes/renthalhive-child/hivepress-geolocation/includes/templates/class-listing-map-block.php

Any guidance on how to override this correctly ?

Hi,

Everything in includes will not be overwritten, only what you overwrite in template parts. Also, this is not a template part, so you need to do everything using the hook: hivepress/v1/templates/listing_map_block. You can check this samples: Search · user:hivepress template · GitHub
Also, please check this doc: How to override template parts - HivePress Help Center

​I hope this is helpful to you.

Thanks, it’s working.

I was able to create this snipped :

add_filter(
    'hivepress/v1/templates/listing_map_block',
    function( $template ) {
        return hivepress()->helper->merge_trees(
            $template,
            [
                'blocks' => [
                    'listing_container' => [
                        'blocks' => [
                            'listing_title' => [
                                'blocks' => [
                                    'listing_title_image' => [
                                        'type'   => 'part',
                                        'path'   => 'listing/view/block/listing-image',
                                        '_order' => 30,
                                    ],
                                ],
                            ],
                        ],
                    ],
                ],
            ]
        );
    },
    1000
);

Might be not the best one as I’m not developper but it’s working. You may adjust and add on Github.
It displays the image on the map :

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.