Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 33 total)
  • Author
    Posts
  • in reply to: Custom Field trasnlation with Polylang Pro #49126
    webdevwebdev
    Participant

    Yes, correct, the 'copy' setting behaves like that... but the 'translate' setting behaved exactly the same...
    As it happens, I've uninstalled Polylang for this project and am using WPML, as there were some errors showing up in Settings forms, so I won't be able to test any more anyway...

    in reply to: Custom Field trasnlation with Polylang Pro #49118
    webdevwebdev
    Participant

    I have text in the field, eg:

    'My text in language 1'

    I create a translation:

    The text in the field reads:

    'My text in language 1' <-- this is correct so far

    I change the text in the translation to:

    'My text in language 2' <-- create a translation

    Save the translation.

    When I go back to the original, it reads:

    'My text in language 2' <-- showing the translated text where it should show the original

    If I change it back to the original text then the translation also changes, ie both the translation and the original are always the same (as in a 'copy')

    in reply to: add fields to Quick Edit section #48467
    webdevwebdev
    Participant

    +1 for this feature too. It would be really useful

    in reply to: Customizer Settings and fields #48303
    webdevwebdev
    Participant

    Sorted now... my mistake... I'd downloaded the theme from our Git repo and it was zipped up as '[my-them-slug]-main.zip' with a corresponding 'main' folder inside.
    When uploaded without the 'main' part added by Git, it all works as expected

    in reply to: Customizer Settings and fields #48299
    webdevwebdev
    Participant

    Hmm,

    It's really weird... On my dev site, the option is saved under that name, but on the live site, that setting does not exist, and if I

    var_dump(wp_load_alloptions());

    (which shows all saved options), there is nothing containing anything like the expected content.

    But the content is definitely being saved because if I go to the Customizer, edit the wysiwyg, save and then reload, the content is still there...

    Do you have any other ideas? Is it just being saved by MetaBox in a meta field somewhere?

    in reply to: Customizer Settings and fields #48293
    webdevwebdev
    Participant

    Apologies for the late reply...
    That seems to work for showing the field in the correct place, but I can't work out how to retrieve the value.

    I have removed the entire 'mb_settings_pages' filter and function as suggested in the docs you pointed out, so my function is now just this:

    <?php
    
    add_filter( 'rwmb_meta_boxes', 'wcpp_masthead_field', 1 );
    
    function wcpp_masthead_field( $meta_boxes ) {
        $prefix = '';
    
        $meta_boxes[] = [
            'title'          => __( 'Homepage Intro Text', 'wcpp' ),
            'id'             => 'homepage-masthead-wysiwyg',
            'panel'         => '',
            'fields'         => [
                [
                    'name'              => __( 'Masthead Text', 'wcpp' ),
                    'id'                => $prefix . 'masthead_text',
                    'type'              => 'wysiwyg',
                    'raw'               => false,
                    'required'          => false,
                    'clone'             => false,
                    'hide_from_rest'    => false,
                    'hide_from_front'   => false,
                    'limit'             => 150,
                        'wpautop' => false,
                    'limit_type'        => 'character',
                    'options'         => [
                        'media_buttons' => true,
                        'teeny'         => false,
                        'tinymce'       => [
                            'toolbar1' => 'bold,italic,underline,|,bullist,numlist,|,link,unlink',
                            'toolbar2' => '',
                            'toolbar3' => '',
                            'toolbar4' => '',
                            'toolbar5' => '',
                            'wpautop' => false,
                        ],
                        'quicktags'    => false,
                    ],
                ],
            ],
        ];
    
        return $meta_boxes;
    }

    If I show all options available, then I can see the relevant content under an option called 'theme_mods_[my-theme-slug]' but this only works on ym developemnt machine, presumably because of an old setting, as it is not available on the live version. I can't tell from the docs which is the option name I need to call, or if I'm missing something in the definition of the Customizer panel above.

    Thanks for your help.

    in reply to: Best way to import into custom_html field #47491
    webdevwebdev
    Participant

    Hi again, I did share admin details with you, but forgot to update here, so perhaps it was missed. But...

    UPDATE:
    I still haven't managed to get it working linking to a function in 'callback', however if I put the function name in the 'std' field, I can get it to work. I just have to use output buffering, like so:

    The std field contains the function call, instead of the callback field...

            'fields'         => [
                [
                    'name'            => __('How to generate some content', 'text-domain'),
                    'type'            => 'custom_html',
                    'std'        => get_help('help_page'),
                    // 'callback' => get_help('help_page'),
                ],
    

    and return the output buffer in get_help()...

    function get_help($file){
        ob_start();
        include ($file.'.php');
        return ob_get_clean();
    }

    So this looks like a work-around.

    My question now though, is this ok to use?
    Could it break in future updates to MB?
    In short, is it a good idea 🙂 ?

    in reply to: Best way to import into custom_html field #47389
    webdevwebdev
    Participant

    Hi,
    Thanks, but unfortunately I'm working on a local wp-env installation so you won't be able to get to it...

    in reply to: Best way to import into custom_html field #47370
    webdevwebdev
    Participant

    ... and I just tried with it in a standard post instead of a settings page - as before, the content is rendered, but directly after the <body> tag of the html, so in the wrong place. Any ideas please?

    in reply to: Best way to import into custom_html field #47343
    webdevwebdev
    Participant

    Hi again,
    Apologies for delay in replying to this - Other things have got in the way... I just tried again, and I can get the contents of the included PHP file to be rendered, but they are not in the right place - it seems to render it before any other content (behind the main WordPress backend nav) rather than in the correct place on the screen.
    I am trying to do this in a tab on a Settings page (if that makes any difference). I have tried removing the tabs to see if that makes any difference but it doesn't help.

    in reply to: Best way to import into custom_html field #46546
    webdevwebdev
    Participant

    On a settings page, so I have something like this:

    
            'title'          => __('General Settings', 'text-domain'),
            'id'             => 'general-settings',
            'settings_pages' => ['some-settings'],
            'tab'            => 'Settings',
            'fields'         => [
                [
                    'name'            => __('How to generate some content', 'text-domain'),
                    'type'            => 'custom_html',
                    'callback'        => get_help('help_page'),
                ],
    

    and putting my function name with a paramater in the callback section doesn't work. If I have the callback function as a string, then it does work, but then I don't know how to include a parameter...

    in reply to: Best way to import into custom_html field #46544
    webdevwebdev
    Participant

    Hi,
    Sorry, I don't think I was clear in the initial question. I'm generating the Settings page using a custom_html field and want to use the 'callback' key for the custom_html field.

    Adding a parameter to a callback doesn't work for me there.

    in reply to: Conditional login in swich on 1.30.1 #46394
    webdevwebdev
    Participant

    Same problem here. I'm getting the following error in the console:

    <div>Uncaught Error: Syntax error, unrecognized expression: ##type_1:not(.rwmb-clone-template ##type_1)</div>

    in reply to: Latest update has broken Metabox Builder #45039
    webdevwebdev
    Participant

    Yeah... strange.
    I've just tried updating again, and it works as expected now...
    Oh well...
    ¯\_(ツ)_/¯

    in reply to: Suggestion #45020
    webdevwebdev
    Participant

    PS, I know there is the option of 'add_new' => true when defining the field in a fields group, but as this loads the whole backend screen including, description, slug, image, etc, I think it's too confusing for users and the standard WP interface would be far easier.

Viewing 15 posts - 1 through 15 (of 33 total)