Replacing the text with an attribute from the ad

Hello, I would like to change the text that appears when you hover over the paid ad icon. Now there is a standard phrase “Featured”.

I want the attribute value from the ad to be displayed instead of this text. As an example, the attribute is called “token_ord”. I even found a piece of code where I need to change it. File listing-featured-badge.php

<?php
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;

if ( $listing->is_featured() ) :
	?>
	<div class="hp-listing__featured-badge hp-listing__featured" title="<?php echo esc_attr_x( 'Featured', 'listing', 'hivepress' ); ?>">
		<i class="hp-icon fas fa-star"></i>
	</div>
	<?php
endif;

Help me replace the text with my attribute?

Hello,

I am not part of the support, and I don’t have access to your website, but the way I look at it, you don’t have to rely on “heavy” changes (on the server-side, PHP based).

Some Javascript manipulations would do the trick just as well.
It would be easy with jQuery (a handy javascript library), where you would update the “featured” text attribute (could be “title” or “alt” attribute for element DIV or IMG).

I suggest you take a look at this :

Hi,

Yes, you need to overwrite this file that you found with the child theme, then after the update from our side, your code will not be deleted, please check this documentation: How to override template parts - HivePress Help Center
Additionally, you will need to replace the featured text with this code: <?php echo esc_attr($listing->get_fieldnamehere()); ?>

​I hope this is helpful to you.

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