Carbon-fields: Upgrading from 1.3 -> 1.4 breaks some use of `show_on_page($page_path|$page_id)`

Created on 14 Nov 2016  路  4Comments  路  Source: htmlburger/carbon-fields

When upgrading to 1.4 fields are no longer shown on specified page with the exact same code.

This used to show the custom field for the page with the slug 'frontpage'.

Container::make('post_meta', 'Frontpage content')
    ->show_on_page('frontpage')
    ->add_fields(array(
        Field::make('text', 'title')->set_default_value('Some text')
    ));

Changing it to
->show_on_page($id) or ->show_on_post_type('page')
displays the custom field on the page.

I tried this with several pages, and also checked that the query index.php?pagename=frontpage gave the desired page. So the path should be correct.

Most helpful comment

Thanks!
Such awesome speed on resolution and answers!
And again, thanks for this awesome plugin :dancing_men:

All 4 comments

Further more, this actually works
->show_on_page(\get_page_by_path( 'frontpage' )->ID)

Hi @Jeger and thanks for the report. This is a bug that we fixed today. Try using a page id instead of a slug until we release the next version.

Duplicate of https://github.com/htmlburger/carbon-fields/issues/120.

Thanks!
Such awesome speed on resolution and answers!
And again, thanks for this awesome plugin :dancing_men:

You are welcome :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Roman52 picture Roman52  路  3Comments

proweb picture proweb  路  3Comments

abdusfauzi picture abdusfauzi  路  3Comments

Mick00 picture Mick00  路  3Comments

AlexBa picture AlexBa  路  3Comments