{"id":8651,"date":"2023-09-15T12:41:02","date_gmt":"2023-09-15T09:41:02","guid":{"rendered":"https:\/\/creativethemes.com\/blocksy\/?post_type=documentation&amp;p=7376"},"modified":"2023-09-15T12:41:02","modified_gmt":"2023-09-15T09:41:02","slug":"add-gender-specific-translations","status":"publish","type":"documentation","link":"https:\/\/creativethemes.com\/blocksy\/docs\/code-snippets\/add-gender-specific-translations\/","title":{"rendered":"Add Gender-specific Translations"},"content":{"rendered":"\n<p>Some languages might have different prepositions or words that depend on the gender of the main noun. For example, the next\/previous labels from the post navigation. These can be different depending on the post name.<\/p>\n\n\n\n<p>We can only achieve this with a little bit of code, as WordPress still does not support this feature &#8211; <a href=\"https:\/\/core.trac.wordpress.org\/ticket\/42725\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">https:\/\/core.trac.wordpress.org\/ticket\/42725<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Next\/Previous labels for Post Navigation<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>add_filter(\n\t'blocksy:post-navigation:previous-post:label',\n\tfunction ($default) {\n\t\t\n\t\tif (get_post_type() === 'post') {\n\t\t\treturn __( 'Abracadabra %s', 'blocksy' );\n\t\t}\n\t\t\n\t\treturn $default;\n\t}\n);\n\nadd_filter(\n\t'blocksy:post-navigation:next-post:label',\n\tfunction ($default) {\n\t\t\n\t\tif (get_post_type() === 'post') {\n\t\t\treturn __( 'Abracadabra %s', 'blocksy' );\n\t\t}\n\t\t\n\t\treturn $default;\n\t}\n);<\/code><\/pre>\n\n\n\n<p>In this example, we grab the necessary post type, then modify the translation of the next\/previous label on the fly.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some languages might have different prepositions or words that depend on the gender of the main noun. For example, the next\/previous labels from the post navigation. These can be different depending on the post name. We can only achieve this with a little bit of code, as WordPress still does not support this feature &#8211; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"doc_categories":[125],"class_list":["post-8651","documentation","type-documentation","status-publish","hentry","doc_categories-code-snippets"],"blocksy_meta":[],"acf":[],"_links":{"self":[{"href":"https:\/\/creativethemes.com\/blocksy\/wp-json\/wp\/v2\/documentation\/8651","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/creativethemes.com\/blocksy\/wp-json\/wp\/v2\/documentation"}],"about":[{"href":"https:\/\/creativethemes.com\/blocksy\/wp-json\/wp\/v2\/types\/documentation"}],"author":[{"embeddable":true,"href":"https:\/\/creativethemes.com\/blocksy\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/creativethemes.com\/blocksy\/wp-json\/wp\/v2\/comments?post=8651"}],"version-history":[{"count":0,"href":"https:\/\/creativethemes.com\/blocksy\/wp-json\/wp\/v2\/documentation\/8651\/revisions"}],"wp:attachment":[{"href":"https:\/\/creativethemes.com\/blocksy\/wp-json\/wp\/v2\/media?parent=8651"}],"wp:term":[{"taxonomy":"doc_categories","embeddable":true,"href":"https:\/\/creativethemes.com\/blocksy\/wp-json\/wp\/v2\/doc_categories?post=8651"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}