There are “printf” statements all over the BuddyPress default theme. What do they mean?
Today, I decided to invest an hour into finding the answer to that question. Here is my answer.
In short, “printf” is php code used to help make themes display words and phrases from other languages. For a long answer and how-to, read this.
Here’s an example, in the BuddyPress default theme’s footer.php file, you will find the following line of code:
printf( __( '%s is proudly powered by WordPress and BuddyPress', 'buddypress' ), bloginfo('name') );
If you look at line #2963 in “buddypress –> bp-languages –> buddypress.pot”, you will see the same code as above.
Basically, these printf statements give us a central location to change certain “special” words and phrases across a BuddyPress website. For example, you might want to change all instances of “Login” to a different word (or language). You might want to change “Groups” to “Communities”, as the Custom Groups Name plugin does.
I am a beginner at this printf stuff, and that is as simple an answer as I can give right now. All you .pot and .mo gurus out there, please let me know if I misspoke at all. 🙂
More posts from themightymo.com
use a plugin to do a bunch of optimizations on this site, but for some reason, the preloading of fonts is broken. So I rolled my own font preloading function and placed it in my functional plugin (You could also put it in functions.php). Here’s the code.
Beaver Builder doesn’t give you an interface to change the background color of the sticky menu after scrolling. Here’s a simple bit of CSS that can help.
Today I decided to invest 1 hour optimizing themightymo.com. Below are the actions I took along with the results. Speed Benchmarks and Initial Observations Before starting on today’s speed optimization, Google Pagespeed Insights scored us as a “44”. There’s some files loading from the wp.com cdn (e.g. Jetpack’s cdn) – Google is penalizing me for…