Join our new community forum for support & discussion
Join NowHome › Support › Extensions › Favorites › Move Favorites link to sidebar
Move Favorites link to sidebar
-
AuthorPosts
-
sowickesited 11 months, 2 weeks ago
I am using the RentalHive theme.
I would like to move the “Add to Favorites” link to the sidebar under the “Send Message” button.
I read the post https://hivepress.io/support/topic/how-do-i-get-the-username-and-email-address-of-the-user-who-reports-listing/ but I’m unclear on the resolution to a similar question.
Please check the sample code snippet here https://hivepress.io/support/topic/sort-by-3/#post-25595 It moves the listing_rating, but you can try moving the listing_favorite_toggle block in the same way. This tutorial may also be useful https://www.youtube.com/watch?v=LkojYp-8uwY&ab_channel=HivePress
sowickesited 11 months, 1 week agoThank you for the direction @ihor.
I have successfully hidden the “add to favorites” in the header. But I’m not sure how to move it to the sidebar. Here’s what I have so far:
add_filter( 'hivepress/v1/templates/listing_view_page', function( $template ) { return hivepress()->helper->merge_trees( $template, [ 'blocks' => [ 'listing_favorite_toggle' => [ 'type' => 'content', ], 'page_sidebar' => [ 'blocks' => [ 'listing_favorite_toggle' => [ 'type' => 'part', 'path' => 'blocks/favorite_toggle', '_order' => 20, ], ], ], ], ] ); }, 1000 );
Please try to define this listing_favorite_toggle block in the same way as it’s set in the extension, it should be ok then https://github.com/hivepress/hivepress-favorites/blob/master/includes/components/class-favorite.php#L137
sowickesited 11 months, 1 week agoBrilliant. Thanks for your assistance @ihor
Here’s the code I used to move the “Add to Favorites” link on the listing pages to the sidebar below the “Send Message” button
add_filter( 'hivepress/v1/templates/listing_view_page', function( $template ) { return hivepress()->helper->merge_trees( $template, [ 'blocks' => [ 'listing_favorite_toggle' => [ 'type' => 'content', ], 'page_sidebar' => [ 'blocks' => [ 'listing_favorite_toggle' => [ 'type' => 'favorite_toggle', '_order' => 20, 'attributes' => [ 'class' => [ 'hp-listing__action', 'hp-listing__action--favorite' ], ], ], ], ], ], ] ); }, 1000 ); ?>
Thanks for sharing!
-
AuthorPosts
New Reply
This forum has been archived and is no longer accepting new posts or replies. Please join our new community forum for support & discussion.