In the Template.php (line 78) file I want to change the text placeholder line in the search form “What do you want to know?” to something else. Can I add this file to my child theme so I don’t lose it when the plugin updates? (like dwqa-templates)
<input data-nonce="” type=”text” placeholder=”” name=”qs” value=””>
You can translate this sentence to your language by following this guide: https://premium.wpmudev.org/blog/how-to-translate-a-wordpress-plugin/
huh?
Can I change the Template.php file in a way that it won’t get written over when the WP Questions and Answers plugin updates?
like adding it to “dwqa-templates” folder? or?
No, Just add a translate file to replace this text. The Template.php file can’t be override by copy into “dwqa-templates” folder. What language are you using?
It is still english I just wanted to change the statement in the search box. I understand. Thank you!
If you want to change the placeholder that you don’t want to lose it when the plugin updates, you only use the .po file or add the following code to the footer.php file in your theme.
Note: You can add this code in the bottom of the file and above </body> tag
<script>
jQuery(document).ready(function($){
$('.dwqa-search').find("input[type=text]").each(function(ev)
{
if(!$(this).val()) {
$(this).attr("placeholder", "Search this site");
}
});
});
</script>
Perfect, I used the jQuery option.
Thanks Dominic!
My pleasure! If you have any issue or question. Please let me know, I will check and help you resolve it.
Please login or Register to submit your answer