John Murphy
asked 8 years ago

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=””>

3 Answers
Jackie Lord
answered 8 years ago

You can translate this sentence to your language by following this guide: https://premium.wpmudev.org/blog/how-to-translate-a-wordpress-plugin/

John Murphy
replied 8 years ago

huh?

John Murphy
answered 8 years ago

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?

Jackie Lord
replied 8 years ago

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?

John Murphy
replied 8 years ago

It is still english I just wanted to change the statement in the search box. I understand. Thank you!

DominicStaff
answered 8 years ago

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>
John Murphy
replied 8 years ago

Perfect, I used the jQuery option.
Thanks Dominic!

Dominic Staff
replied 8 years ago

My pleasure! If you have any issue or question. Please let me know, I will check and help you resolve it.

Powered by DW Question & Answer Pro