- English
- 日本語
Abstract
Hello everyone, It’s me candle.
In this time, I will show you how to customize wordpress bogo short code.
The items to introduce are these.
- The flag display or hide
- Change the text
Related article
How to change the language form “en-US” to “en” by wordpres bogo
Precondition
WordPress bogo has been installed
You can edit the theme of wordpress
The flag display or hide
Bogo’s short code will show links to other languages.
The flags will be displayed automatically.
In some cases, you don’t need flags.
Let’s hide it.
Open the functions.php in each theme’s folder.
It is generally in the following place.
Write it.
add_filter( 'bogo_use_flags','bogo_use_flags_false'); function bogo_use_flags_false(){ return false; }
You return false with add_filter, the flags will be hide.
Change the displayed text
For example, if you change the language from en-US to en,
you feel strange that English text is still “English (United States)”.
From here, I will show you how to change the text from “English (United States)” to “English”.
Of course, you can also change the something another letters.
Open the functions.php and write this.
add_filter( 'bogo_language_switcher','replace_bogo_text'); function replace_bogo_text($output){ return str_replace(' (United States)','',$output); }
Actually this function is quite a power technique.
It replaces the whole result generated by [bogo].
I tried to find out the more smart method, but I think that this is the best for now.
You can see that the text is changed.
Change the short code from the foundation
There is a method to change from the fundamentally rather than a change like a patch.
That method is to override the function to generate short code in the bogo plugin.
When large-scale changes, you can customize more finely using this method.
Although I don’t write it in this article, it is written in the following site in detail.
(It is written in Japanese)
https://qox.jp/blog/bogo-wordpress/
Conclustion
Enjoy your wordpress life.