Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 16 through 30 (of 61 total)
  • Author
    Posts
  • in reply to: WYSIWYG Editor Not Working Correctly #23896
    Teia Local StudioTeia Local Studio
    Participant

    THANK you SO MUCH.
    I am not in a hurry, but just want to have things working... Can't sleep well at night knowing about the bug. =) Ha ha!

    in reply to: WYSIWYG Editor Not Working Correctly #23871
    Teia Local StudioTeia Local Studio
    Participant

    Hej there!

    Guys, I am having the same problem with METABOX 5.3.6.
    I did register a WYSIWYG metabox and its behavior is completely erratic.

    The data I enter on the VISUAL tab is not visible no the CODE tab, and vice versa. Switching tabs does not update its contents. Also, sometimes it does not save when I publish the post. Sometimes it does. It's strange.

    Reverting back to 5.3.5 solves the problem...
    But it is not a solution — we need to stay up-to-date.

    Any ideas?
    G.

    in reply to: MB for Yoast not counting words #23681
    Teia Local StudioTeia Local Studio
    Participant

    Well...
    Found a workaround using LOCALIZE SCRIPT and injecting the content of my metabox as a VAR inside the JS.

    
    function my_admin_personal_scripts() {
    
        if (in_array('wordpress-seo/wp-seo.php', apply_filters('active_plugins', get_option('active_plugins')))) {
            
            global $post;
            $countable_content = get_post_meta($post->ID, 'my-super-duper-metabox-id', true);
            
            wp_register_script('yoast-counting-words', MY_JS_PATH.'/misc/injected-yoast-counter.js');
            $content_found = array('metabox'=> $countable_content);
            
            wp_localize_script( 'yoast-counting-words', 'content_found', $content_found );
            wp_enqueue_script( 'yoast-counting-words' );
        }
    
    }
    add_action('admin_enqueue_scripts', 'my_admin_personal_scripts');
    

    And, inside the JS, I retrieve the content this way:

    
    (...)
     addContent( data ) {
            data += content_found.metabox;
        //console.log(content_found.metabox);
            return data ;
        }
    (...)
    

    It could be useful to someone else!
    G.

    in reply to: MB for Yoast not counting words #23679
    Teia Local StudioTeia Local Studio
    Participant

    Hello again!

    I found a tutorial on YOAST page that made the counter work for me:

    
    /* global YoastSEO */
    
    class MyCustomDataPlugin {
        constructor() {
           // Ensure YoastSEO.js is present and can access the necessary features.
           if ( typeof YoastSEO === "undefined" || typeof YoastSEO.analysis === "undefined" || typeof YoastSEO.analysis.worker === "undefined" ) {
                return;
            }
    
            YoastSEO.app.registerPlugin( "MyCustomDataPlugin", { status: "ready" } );
            
            this.registerModifications();
        }
    
        /**
         * Registers the addContent modification.
         *
         * @returns {void}
         */
        registerModifications() {
            const callback = this.addContent.bind( this );
    
            // Ensure that the additional data is being seen as a modification to the content.
            YoastSEO.app.registerModification( "content", callback, "MyCustomDataPlugin", 10 );
        }
    
        /**
         * Adds to the content to be analyzed by the analyzer.
         *
         * @param {string} data The current data string.
         *
         * @returns {string} The data string parameter with the added content.
         */
        addContent( data ) {
            data += "Hello, I'm some additional data!";
    
            return data ;
        }
    }
    /**
     * Adds eventlistener to load the plugin.
     */
    if ( typeof YoastSEO !== "undefined" && typeof YoastSEO.app !== "undefined" ) {
      new MyCustomDataPlugin();
    } else {
      jQuery( window ).on(
        "YoastSEO:ready",
        function() {
          new MyCustomDataPlugin();
        }
      );
    }
    

    But I have no idea what should I put there on the line — addContent(data).
    The example shows a hardcoded text. How can I put there a METABOX FIELD ID, for example?

    Any suggestions?

    Thanks!

    Teia Local StudioTeia Local Studio
    Participant

    Just to put a closure here — found the problem and it was not metabox related... But it worth mention, could help someone else in a similar situation.

    I was using 2 filters to remove the VERSION in the enqueued scripts and styles on theme. Apparently this was the root of the problem when updating WP version with this code running.

    
    function remove_css_js_version($src) {
        if (strpos($src, '?ver='))
            $src = remove_query_arg('ver', $src);
        return $src;
    }
    add_filter('style_loader_src', 'remove_css_js_version', 9999);
    add_filter('script_loader_src', 'remove_css_js_version', 9999);
    
    Teia Local StudioTeia Local Studio
    Participant

    Oh.

    I really can't replicate the bug.
    Tried on a new fresh WP install, with my theme...

    Nothing wrong happened.

    Restored the database from the problematic one, changed back to my theme (I went to defaults for test) and the problem is gone.

    Really have no idea. Perhaps some kind of JS browser cache when I updated to 5.6?

    No idea.
    Anyway, thanks everybody.
    Moderation, feel free to lock the topic, please.

    Teia Local StudioTeia Local Studio
    Participant

    I believe the issue is not directly related to MetaBox itself, forgot to mention. I am just looking form some ideas, after all.

    Thanks.

    Teia Local StudioTeia Local Studio
    Participant

    THANK YOU GUYS!
    Long live to META BOX family!

    Teia Local StudioTeia Local Studio
    Participant

    Guys,

    Any news?
    There is something wrong here really indeed!

    Thaaanks!
    G.

    Teia Local StudioTeia Local Studio
    Participant

    Oh!

    Metabox TOOLTIP. I was completely unaware of this extension. Thanks for the suggestion. Really nice indeed!

    Best regards,
    G.

    Teia Local StudioTeia Local Studio
    Participant

    It's important to note:

    All values GET SAVED indeed. The problem is that they does not retain on the fields. If you need to edit your taxonomy or CPT you will need to write all your labels again, except for the first one (as pointed by Cedric), otherwise, on the next save, all will be reverted to English default values.

    Thanks guys!

    Teia Local StudioTeia Local Studio
    Participant

    This:

    And this:

    =)

    Teia Local StudioTeia Local Studio
    Participant

    Hello, Long.

    Yes yes, I understand perfectly, but I was talking about the attribute title IN A FIELD itself, not the general title of a array of fields — the whole metabox thing.

    My suggestion:

    <img id="my-id" src="xxx" alt="abc" TITLE="my-id" />
    <input type="text" id="my-id2" size="30" TITLE="my-id2" />
    <select id="my-id3" name="pick-a-boo" title="my-id3"> ... </select>

    What we have today:

    <img id="my-id" src="xxx" alt="abc" />
    <input type="text" id="my-id2" size="30" />
    <select id="my-id3" name="pick-a-boo"> ... </select>

    It could be added on the metabox root code, however I can'r mess up the core code there, because it will me lost upon updating:

    if ( class_exists( 'RWMB_Field' ) ) {
        class RWMB_Phone_Field extends RWMB_Field {
            public static function html( $meta, $field ) {
                return sprintf(
                    '<input type="tel" name="%s" id="%s" value="%s" title="%s">',
                    $field['field_name'],
                    $field['id'],
                    $meta,
                    $field['id'] // <------- THIS
                );
            }
        }
    }

    Well, just and idea. I found a workaround using jQuery, but it would be great to have this implemented, at least on INPUT, SELECT, TEXTAREA.

    Thank you!

    Teia Local StudioTeia Local Studio
    Participant

    Well,

    I just accomplished a satisfactory result injecting some custom jQuery on WordPress admin. Using the code below I can force the most common fields to have a TITLE attribute based on their IDs:

    
    jQuery('input, textarea, select, .wp-color-picker').each(function(){
        jQuery(this).attr('title', jQuery(this).attr('id'));
    });
    jQuery('.rwmb-switch').each(function(){
        jQuery(this).next().attr('title', jQuery(this).attr('id'));
    });
    jQuery('label').each(function(){
        jQuery(this).attr('title', jQuery(this).attr('for'));
    }); 
    

    Hope to be useful to someone!
    G.

    Teia Local StudioTeia Local Studio
    Participant

    Another problem found...

    You create a CPT, change its labels to anything else than the default. They get saved (but the fields remain in default EN). Then you think, a far as I do not edit it again, its okay...

    But then you access the extension to create a taxonomy, and, after creating it, the CPT got its labels all reset to default again.

    Oh my.

Viewing 15 posts - 16 through 30 (of 61 total)