Archived topic
GeneratePress as a Dictionary
3 replies · Started by Roman on February 1, 2021
Hello,
I'd like to create a dictionary.
Search results should contain both languages.
I thought about a second Title bar, yes there are plugins but not maintained.
Now I put both languages into the title and split them with <br>.
It is not very sophisticated, but it works without a plugin:-)
I could use a new field with Advanced customs fields, but I would not get is as nice as here:
http://ostrov.cesky-nemecky.cz/
What could you recommend to me?
How to get two languages in one result line?
Hi there,
I'm not exactly sure I fully understand what you're trying to do.
Do you have any reference site you'd like to replicate?
To clarify: You're trying to add the term's translation of a post on post listing in archive pages and search result pages?
If that's the case, since you're familiar with ACF, we can do this:
Assuming you're using ACF to place in your translation text strings, you can hook this ACF field values to display on your post entry by using a Hook Element or Block Element.
More about Hook element here: https://docs.generatepress.com/article/hooks-element-overview/
Say for example, you have an ACF field 'translation' you want to display after the post's entry title.
You can create a Hook Element with a hook set to generate_after_entry_title with its display rule set to "Post - all posts", "All archives", "Blog" and "Search Results". Also make sure "Execute Shortcode" is checked.
You then add your ACF shortcode that displays the ACF field you want to display within the Hook Element's code area:
Example: [acf field="translation"]
As for the actual translations and A-Z listing, you'll have to get a plugin for them.
Hi Elvin,
thx for you help.
There is no site to replicate.
There are many Glossary and Dictionary Sites, but they dow not allow to show the Terms in language 1 and in language 2 in the search results.
I do not want to "open" then text just to see the translation.
Another way how to do it:
TERM1 is in the Title
TERM2 is in the article and the article shows only excerpt with 10 Words oder better just 1 line
TERM LANGUAGE1
term language 2
(read more)..
TERM LANGUAGE1
term language 2
(read more)..
I will try to understand, how to do it with ACFs.
Roman
You can add more ACF fields for the other languages.
Say for example, within your Hook Element, you can multiple shortcodes for multiple term languages depending on how many fields are added.
Example:
[acf field="term_language_ENG"]</br>
[acf field="term_language_RUS"]</br>
[acf field="term_language_JP"]