Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 31 through 45 (of 61 total)
  • Author
    Posts
  • Teia Local StudioTeia Local Studio
    Participant

    UPDATE!!!

    Just did a clean install of WordPress.
    Default official theme. Nothing changed or custom.
    Installed METABOX FREE and METABOX CUSTOM POST TYPES FREE.

    Everything works fine BUT the custom post types and taxonomies label values.

    The only one who retains the modified value is the very first field — ADD NEW.
    The other fields, when you change the label value (although saving to database), revert back to the default English term when the screen reloads.

    Imagine having 10 CPTs, all with nice labels in other language... Then you need to edit all of them, form some other reason, like, remove Thumbnail support, etc etc... and then, you need to re-crete all labels for all the 10 cpts, because all fields are back to their default!

    Sounds something is not right here, what do you think?
    Can you please inspect?

    Thaaaanks!
    G.

    Teia Local StudioTeia Local Studio
    Participant

    Hey there!

    Just found, inside MB-AIO folder, a fr_FR PO/MO file that contains the strings I look forward to have translated... But I have no idea how to add this and where add this to my Portuguese WordPress. Everything is sooo confusing. I can't even turn off pt_BR global translation (for a test)!

    What should I do?
    Can someone provide some simple steps?

    In time:

    LOCO shows me a lot of stuff from MetaboxAIO, but does not show me nothing related to the regular MetaBox base plugin at all.

    Teia Local StudioTeia Local Studio
    Participant

    Dear Long,

    Got LOCO working (still learning how to handle it) and make progress translating MB-CPT plugin English terms to Portuguese, however, LOCO can't locate any of the ENGLISH LABEL TERMS. They are nowhere to be found on the compiled brand new POT file.

    I really need to translate the labels itself, not the plugin screens...
    Need to put in Portuguese the field values, like:

    Add new XXX,
    All XXX,
    Edit XXX,
    New name for XXX,
    View XXX,
    Search XXX,
    etc, etc.

    Upon a quick inspection, these values are hard coded inside minified JS files:
    wp-content\plugins\meta-box-aio\vendor\meta-box\mb-custom-post-type\post-type.js
    and
    wp-content\plugins\meta-box-aio\vendor\meta-box\mb-custom-post-type\taxonomy.js

    Or, in the end... Alt least the input text fields for the labels should retain the entered value, and not refreshing always with the default English ones.

    Thanks!!
    G.

    Teia Local StudioTeia Local Studio
    Participant

    Dear Long,

    I can't still figure out what could be the problem, but I will take a look on Loco translate. More info:

    The MBCPT plugin itself is loading in English (not a big problem for me), but what I refer too is the content of each label. They are also in English, of course, but I can't modify them permanently. Steps:

    1. I do create a "Foo" custom post, all OK.
    2. I name plural and singular, "Foos" anf "Foo", all OK.

    1. I go to CPT labels and change from, for example, "Add new Foo" to "Adicionar Novo Foo". And I change "All Foos" to "Todos os Foos"... And it is ALMOST OK.

    The changes are made, the labels are indeed modified, but the text field itself, on the plugin, retains the old value in English. If I need, for some reason, edit the CPT again, I need to rename aaaall labels once more, otherwise the will be re-saved with the original English values the plugin provides.

    If I radically change it to any crazy text, it get's saved, but upon entering the CPT's edit screen again, the value will not be there.

    But is is strange, because the same problem happened using just free the MB and MBCPT on on a different theme, a commercial one (mine is all custom and I use premium AIO). On both themes I just activate MB's plugins and use a custom code to "boot" the metaboxes (did learn on your old tutorials). Perhaps my custom way of starting MB internals is breaking something?

    This is the way I do:

    
    function teialocal_register_meta_boxes() {
    
            include 'boxes/post.php';
            include 'boxes/page.php';
                
            if (post_type_exists('case'))     { include 'boxes/case.php'; }
            if (post_type_exists('event'))    { include 'boxes/event.php'; }            
                
        return $meta_boxes; 
    
    }
    add_filter( 'rwmb_meta_boxes', 'teialocal_register_meta_boxes' );
    

    I will try MB + MBCPT on a default WordPress template to check if it happens there as well.

    Thanks!
    G.

    in reply to: How to Autofill the Title? #22754
    Teia Local StudioTeia Local Studio
    Participant

    I am in a hurry now, but take a look on the "the_date()" function. I think it will help.

    Teia Local StudioTeia Local Studio
    Participant

    Oh, you solved the mystery, my friend Long Nguyen.

    I am happy it is just a technical matter and not a mal-formed PHP code by my part. So, now I can live with it, no problems. Always thank you for the awesomeness of MetaBox!

    Giovani.

    in reply to: How to Autofill the Title? #22745
    Teia Local StudioTeia Local Studio
    Participant

    well,

    You are saying that you need the date/time to be a different one?
    Like for example, the time of a person in another timezone?

    I imagine you could show a select/combo option on the registration page where the user could pick hist location/timezone, and then you could use this info in you new (forced) post name.

    G.

    in reply to: How to Autofill the Title? #22742
    Teia Local StudioTeia Local Studio
    Participant

    I have experienced a similar situation in the past.

    I had a website where a logged in editor/user created a post, but I needed to force the post title to have the current date (formatted to my needs), the current user name and a custom text.

    So, it was required to hide from the current user the post title field (to prevent interference) and set up some custom PHP code on my functions to perform the task, right on post creation.

    I don't think you will achieve this right out-of-the-box with MetaBox suite. You will need to manually add this function to you theme, since it works on a different scenario.

    Here is a simplified version of my code. Just paste it in the end of your functions.php and you will be good to go. Also, you will need to edit it to suit your needs. Hope this helps...

    
    function force_modify_the_post_title( $data , $postarr ) {
            
            // We only care if it is a post_type "post"
            // You can change to any other custom post you have registered, like "booking", "project", etc
            if( $data[ 'post_type' ] === 'post' ) {
    
                // Grab all info about the loggedin user
                global $current_user;
                wp_get_current_user();
                
                // To see all user details:
                // print_r($current_user);
                
                // My new title
                $forced_title = 'This post was created by '.$current_user->display_name.' at '.date('d/m/Y');
    
                // Insert the new post title
                $data[ 'post_title' ] = $forced_title;
                    
                // Sanitize the new post title to create its slug
                $data[ 'post_name' ]  = sanitize_title($forced_title);
                
            }
            return $data;
        }
        add_filter( 'wp_insert_post_data' , 'force_modify_the_post_title' , '99', 2 );
    

    Just tested here on a clean install of wordpress and it worked flawlessly. To test, paste the code and simple go to your control panel and create a new blog post, a simple common one. Pay attention to the title and the slug.

    Regards!
    Giovani.

    Teia Local StudioTeia Local Studio
    Participant

    Hello Long!

    Thanks for the return. I already get the options manually, never use the helper function for anything, a silly habit of mine... =)

    But let's go — there is a lot of code in the middle, but mostly I do the following, simplifying things:

    1. On top of my functions.php I retrieve the related options and store inside a global variable:
    global $mod;
    $mod = get_option( 'my-theme-custom-mbs' );
    

    Every time I need this information, I bring up the $mod variable:

    global $mod;

    So, when I start the meta box registering, I simply use my function check_mbs() to read what meta box do I need to include based on the current $post_id of the running edit screen. My function simplified:

    
    function check_mbs($post_id) {
        
        // Here I retrieve the settings options
        global $mod; 
        
        if (is_array($mod['custom-mbs-for-post-'.$post_id])) {
            foreach ($mod['custom-mbs-for-post-'.$post_id] as $key => $val) {
                $my_mb_file = $key;
                $my_mb_dir = $val;
            }
            $custom_mb = array($my_mb_dir, $my_mb_file);
            return $custom_mb;
        }
    
    }
    

    Then I just call for the meta box inclusion. I have this on a separate file for easy management. It is on a file called custom_mbs_assembler.php.

    
    $post_id = null;
    if ( isset( $_GET['post'] ) ) {
        $post_id = intval( $_GET['post'] );
    } elseif ( isset( $_POST['post_ID'] ) ) {
        $post_id = intval( $_POST['post_ID'] );
    }
    $post_tipo = get_post_type($post_id);
    
    $mbs = check_mbs($post_id); 
    foreach ($mbs as $my_mb) {
        include(TEMPLATE_PATH.'/custom_mbs/'.$my_mb[0].'/custom-'.$my_mb[1].'-metabox.php');
    }
    

    All the code above run inside the "official" registering meta boxes method as instructed on the documentation. In my functions.php I have:

    
    function my_theme_register_meta_boxes() {
        . . .
        include('static_mbs/general.php'); // A bunch of simple metabox all static, admin_colums OK!
        include('static_mbs/foo.php'); // Another bunch of simple metabox all static, admin_coluns OK!
        . . .
        include('custom_mbs/custom_mbs_assembler.php'); // The file mentioned above, no columns oh my =(
        . . .
        return $meta_boxes; 
    
    }
    add_filter( 'rwmb_meta_boxes', 'my_theme_register_meta_boxes' );
    

    By the metabox registering, data saving and retrieving, both on admin and template, all is working flawlessly. Furthermore, I even have conditional logic for INCLUDE/EXCLUDE (using the extension) to prevent some meta boxes to not being loaded/registered on several specific $post_ids, managed in the settings options.

    All fine so far...
    Just admin_colums does not load for them.

    I understand that, without seeing the complete and original code, it will not help much, but anyway, if you have any other ideas of what could be wrong, I do appreciate. Otherwise, never mind, don't worry. I did manage to create my custom columns by hand, directly on the function.php.

    But it is a pity to lose such great MB.IO functionality.

    Thaaaanks!
    Giovani.

    Teia Local StudioTeia Local Studio
    Participant

    WOW.
    I think I found out (after reading some of Ahn's past posts)!

    Instead of calling (via PHP include) my metaboxes fields using just $_GET['post'], I need to do the following:

    $post_id = null;
    if ( isset( $_GET['post'] ) ) {
        $post_id = intval( $_GET['post'] );
    } elseif ( isset( $_POST['post_ID'] ) ) {
        $post_id = intval( $_POST['post_ID'] );
    }
    $post_type = get_post_type($post_id);

    So, my
    <? include(TEMPLATE_PATH.'/metaboxes/'.$post_type.'/my-custom-fields-'.$post_id.'.php'); ?>
    will work!

    Previously I was using (wrongly!):
    <? include(TEMPLATE_PATH.'/metaboxes/'.get_post_type($_GET['post']).'/my-custom-fields-'.$_GET['post'].'.php'); ?>

    Cheers!

    Teia Local StudioTeia Local Studio
    Participant

    FOUND OUT THE PROBLEM!

    There are some settings that I save its state (TRUE or FALSE) inside one array to, depending of what it presents, print different metaboxes in the panel.

    The problem is that — I was printing the metaboxes by any means without check if the array was empty or not...

    And since they used the very info to show a SELECT with OPTIONS (where the options are directly dependent of my informational array) things got broken.

    Woow... What I relief. Minutes after posting the topic I did remember about this scene in my code.

    Moderator please, can you lock the topic? All good now.

    And FOREVER grateful for you suite of MetaBoxes AWESOMENESS.
    Really THANK YOU.

    in reply to: Settings Page Style #21677
    Teia Local StudioTeia Local Studio
    Participant

    THANK YOU!
    SO MUCH.

    in reply to: Settings Page Style #21604
    Teia Local StudioTeia Local Studio
    Participant

    Hey there!

    Is that possible to have the "style" => "seamless" on a specific BOX inside a tabbed settings panel?

    If I set SEAMLESS in the box anywhere inside a page, or CPT, it works fine. But inside the setting page, does not.

    
    $meta_boxes[] = array(
        'id'             => 'my-id',
        'title'          => 'my-title',
        'settings_pages' => 'panel-abc',
        'tab'            => 'tab-123,
        'style'          => 'seamless',
        'fields' => array(
            array(
                'name' => 'Setting name',
                'id'   => 'sett-id',
                'type' => 'text',
                'class' => 'my-class',
                'columns' => 6
            ),
            array(
                'name' => 'Other setting name',
                'id'   => 'sett-id-2',
                'type' => 'text',
                'class' => 'my-class',
                'columns' => 6
            )
        )
    );
    

    Thank you!!!
    G.

    Teia Local StudioTeia Local Studio
    Participant

    Yes, yes, I believe so.

    The problem happens just when we create a CPT with just the TITLE field.
    Creating a CPT with TITLE and other field, just like AUTHOR one, brings no warnings.

    Anyway, it's not a big problem, I just found out pertinent to inform!

    Regards!
    G.

    Teia Local StudioTeia Local Studio
    Participant

    Super!
    So easy...
    =)

    Lock, please!
    Thank you so much as always!
    G.

Viewing 15 posts - 31 through 45 (of 61 total)