Settingspages doesn't work as expected

Support General Settingspages doesn't work as expected

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #34215
    info@ceescoenen.nl[email protected]
    Participant

    I have a big problem with settingspages and I have made a pastebin with code
    https://pastebin.com/A3RQZiB1

    Here you can see what happens: https://update3.ccmp.nl/test/

    Explanation:
    Settingspage 'Website' / '175' with custom fields won't show data in MB View.
    When I add a php code manually (see pastebin) I retrieve the postID (or all other data).
    When I insert a field using MB View I don't retrieve the postID (or all other data).

    I have make a new settingspage ('algemeen' / 'algemeen') and add a customfield to that.
    When I insert a field using MB View I retrieve the PostID (or all other data).

    I really don't understand what is wrong. Please can you help me? This drive me crazy.

    Cees

    #34226
    Long NguyenLong Nguyen
    Moderator

    Hi Cees,

    Can you please share the code that creates the custom fields and settings page on your site?

    #34227
    info@ceescoenen.nl[email protected]
    Participant

    Hi Long,

    I share all the code here in one pastebin

    https://pastebin.com/eQ80WNdm

    #34247
    Long NguyenLong Nguyen
    Moderator

    Hi Cees,

    The homepage news item field is a top field, so no need to access it via a group subfield. Your current code

    {% set group = attribute( site, '175' ) %}
    {% set field = attribute( group, 'ws-dp--hp_newsitem' ) %}
    <b>Value: {{ field.ID }}</b>

    the correct one

    {% set field = attribute( site.Website, 'ws-dp--hp_newsitem' ) %}
    <a href="{{ field.url }}">{{ field.title }}</a>

    just like the new settings page

    Retrieve from the 'new settingspage' with algemeen / algemeen
    {% set field = attribute( site.algemeen, 'al--hompage_blogitem' ) %}
    <b>Value: {{ field.ID }} </b>
    {% set field = attribute( site.algemeen, 'al--hompage_blogitem' ) %}
    <b>{{ field.title }} </b>
    #34254
    info@ceescoenen.nl[email protected]
    Participant

    Hi Long,

    Thanks. But it is the ‘insert field’ button that generates the code for me. That is strange. The code on algemeen is diffeerent indeed but both comes from ‘insert field’. Can you explain this?

    Cees

    #34288
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Please try to re-save the settings page "Website" and re-select the location settings page of the field group then insert the field in View again. 175 looks like a post ID instead of the option name "Website".

    Let me know how it goes.

    #34293
    info@ceescoenen.nl[email protected]
    Participant

    Done but is doesn't work:

    {% set group = attribute( site, '175' ) %}
    {% set field = attribute( group, 'ws-dp--hp_newsitem' ) %}
    {{ field.title }}

    {% set field = attribute( site.algemeen, 'al--hompage_blogitem' ) %}
    {{ field.title }}

    175 is the value that stays in the Settings Page ID box in the builder. It is generated when I make the settingspage, not choosen by me.

    #34294
    info@ceescoenen.nl[email protected]
    Participant

    I hope it is possible to take longer time to look at the problem. Waiting time with another part of the world is 24 hour. Maybe you will login to the site and look what is happen.

    #34295
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Ok, please share your site credentials via the contact form. I will take a closer look.
    https://metabox.io/contact/

    #34298
    info@ceescoenen.nl[email protected]
    Participant

    Hi,

    Send it

    #34310
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Can you please re-check this issue? I've changed the settings page ID from 175 to website and re-select the location of the field group to Website and it works in View. Screenshot https://monosnap.com/file/l7BFlJfyH8AVrWWEJOml9zHccfFWWM

    #34312
    info@ceescoenen.nl[email protected]
    Participant

    Hi Long,

    Changing the ID does fully break my site on other places. As example Oxygen uses the ID, and php code like the RWMB where I have manually add the settings_id to 175.

    So yes, the problem in the view is fixed but I have 10 websites where the ID is 175.

    I haven't set the value to 175 but when I add the settingspage it is set.

    What to do?

    Cees

    #34313
    Long NguyenLong Nguyen
    Moderator

    Hi,

    The ID 175 populated automatically from the post ID when you didn't add the setting title or add it after publishing the setting page. For now, you can use the helper function to get the value

    {% set field = mb.rwmb_meta( 'ws-dp--hp_newsitem', { object_type: 'setting' }, 'Website' ) %}
    <b>Value: {{ field }}</b>

    Follow the documentation https://docs.metabox.io/extensions/mb-settings-page/#getting-field-value

    I will inform the development team to check and fix the issue in this case.

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.