
Lot of users are asking this question: How to modify the “View Listing” text?. Very simple way you can change the text. Just drop the following code in your functions.php file and see the magic.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
add_filter( 'gettext', 'agentpress_change_view_listings_text', 20, 3 ); /** * Change view listings text. * * @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext * @see switch http://php.net/manual/en/control-structures.switch.php */ function agentpress_change_view_listings_text( $translated_text, $text, $domain ) { if ( ( 'agentpress-listings' == $domain ) || ( 'agentpress' == $domain ) ) { switch ( $translated_text ) { case 'View Listing' : $translated_text = __( 'Modified Text', 'agentpress-listings' ); break; } } return $translated_text; } |
“View Listing” text is replacing with “Modified Text”.
Explain: Code is using the WordPress’s gettext() filter. This filter hook is applied to the translated text by the internationalization functions (__(), _e(), etc.). Filter function is accepting three arguments: ‘translated text’, ‘untranslated text’ and ‘text domain’.
IMPORTANT: This filter hook is always applied even if internationalization is not in effect, and if the text domain has not been loaded.
Above code will only work if load text domain is ‘agentpress-listings’ or ‘agentpress’.
Hi Paul,
How to add extra field to AgentPress featured listings widget in home page?
Hi Paul,
How to show the title of listing?
Thanks,
Tai
You need the custom PHP script.
Can you show me how to do?
You can try this plugin https://genesisdeveloper.me/extended-agentpress-listings-widget/ . It will give a widget and put it into the widget area.
Hi Paul, i am not experienced enough yet to know exactly what “drop in code”means. I know it goes in the file. Does it go on any line? Does it replace what is in the file? Is the bracket on line 31 still need to be the ending line? I want to change the “View Listing” to “View Plan”. I am setting up this theme to sell house plans. It is almost just right as it is. Thanks for any help you can give me.
Hi,
Is it possible to remove the text completely?
Roger
Try this
$translated_text = ”;