In the listing in homepage, where you have the text “ADDED On XXX” below the listing name, can we change that to show like a short description about the listing?
I added a new attributes and assigned it all areas but still only the attribute that came in default shows but not the new attribute I created
Hi,
You can hide the date using this CSS snippet Hide the listing publication date #hivepress #listings · GitHub, and display the listing description using this PHP snippet, please check this topic Add description to listings block.
How to add custom code snippets - HivePress Help Center
I hope this is helpful to you.
Hi thanks for the reply. Adding the php code did show the listing description but what I want is to show the custom attribute. Like I said, I created a custom attribute called “Description”, how do i show that instead of show the list main description which has a lot in it?
It currently showing this
But I want this
Hi,
You need to modify the previous snippet I sent you to add a description. Then you will have a custom attribute displayed in the block. Or, as a workaround, you can use the display areas attribute listing and display it in the block, please check this doc How to add listing attributes - HivePress Help Center
Hi I added the attribute to all display areas but its not showing anywhere on the page. With regards to the snippet, what exactly should I change to show the attribute instead of the main listing description?
Hi,
Please disable third-party plugins and customizations (if there are any) and check if this issue persists. If you use a caching plugin, make sure that caching is disabled for logged-in users. Also, make sure you have added this attribute to your listing in WP Dashboard > Listings > Edit listings.
Hi I managed to get the attributes showing but it appears to create a separate box below the header hence making it too far down. Is there a way to make it appear where the main description is showing close to the title?
I currently use below script to show the main description but what can I change in script to show attributes?
add_filter(
'hivepress/v1/templates/listing_view_block/blocks',
function( $blocks, $template ) {
$listing = $template->get_context('listing');
if($listing && $listing->get_description()){
$blocks = hivepress()->helper->merge_trees(
[ 'blocks' => $blocks ],
[
'blocks' => [
'listing_details_primary' => [
'blocks' => [
'custom_listing_block_description' => [
'type' => 'content',
'content' => '<p>'.esc_html($listing->get_description()).'</p>',
'_order' => 6,
],
],
],
],
]
)['blocks'];
}
return $blocks;
},
1000,
2
);
OK I did notice that when I set the attribute to Block secondary, it then appears immediately below the title, however it reduced the width to 50%.
When I add below CSS, it then uses full width but I am not sure if this CSS will affect any another part of the theme?
.hp-col-lg-6 {
flex-basis: auto !important;
max-width: 100% !important;
}
Hi,
Sorry for the inconvenience, but customization is beyond our support scope - it includes fixing bugs and guidance about the available features Support Policy | HivePress
If customizations are required for your site, please try customizing it using the collection of code snippets Search · user:hivepress · GitHub and other developer resources, or consider hiring someone for custom work https://fvrr.co/32e7LvY
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.