ACF Pro and WPML Options pages | Tutorial Tuesday #2

ACF Pro and WPML Options pages | Tutorial Tuesday #2

Matt Seymour

7 лет назад

4,966 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Caio Bleggi de Moura
Caio Bleggi de Moura - 13.12.2018 21:47

That's simply not a solution. You just get back to using a Page as I use to do ten years ago.

Ответить
woutertt
woutertt - 23.07.2018 21:33

Did somewhat the same but made a CPT "Settings". Add as many "pages" there as you want and treat them as Options pages.

Next up query that specific page and get the fields.

public function settings()
{
// Get theme-settings page
$settings_page = get_page_by_path('theme-settings', null, 'settings');
// Get the page for the correct language
$get_translated_id = apply_filters('wpml_object_id', $settings_page->ID, 'settings');

return get_fields($get_translated_id);
}

Inside the Sage 9 Blade Controller let's me use $settings['custom_field'] anywhere in the theme.

Then just make a link in the menu to that specific post, put it on private and voila you have a settings screen which works.

Ответить
François Christiaen
François Christiaen - 17.06.2018 08:21

I have the solution for you. How can I share you this ?

Ответить
Low Glow Flow
Low Glow Flow - 10.11.2017 15:51

OK, so it is not me :) I had the same nightmare, and came up with the same solution. I registered a new post type for this to separate that page from the rest of the normal pages.

Ответить
Sikharin Wandee
Sikharin Wandee - 09.10.2017 12:35

Thanks That's useful!

Ответить
Geoff Yuen
Geoff Yuen - 13.09.2017 18:18

Strange, when I change languages, the fields from the options page do switch correctly to the correct translated fields. What doesn't work is when I modify or add fields, the copy content from EN button is disabled. You have to manually make the same changes to the duplicated field group. I suppose I could use the overwrite button though. Also, the json field syncing seems to mess up quite a bit.

Ответить
Vuduc Nguyenhuynh
Vuduc Nguyenhuynh - 11.08.2017 21:18

Great !
tks you so much !

Ответить