Forum Replies Created

Viewing 15 replies - 1 through 15 (of 62 total)
  • Thread Starter cvladan

    (@cvladan)

    He he. Right 🙂 But it does work.
    Click here to spin-up temporary WP with plugin installed

    https://tastewp.com/create/NMS/8.2/6.2/wp-console/blockify/?ni=true

    and you will see at the right corner of Admin bar option “Console”.

    Thread Starter cvladan

    (@cvladan)

    Thanks 😉

    Thread Starter cvladan

    (@cvladan)

    First of all, it’s incredible how nice of a guy you are! Secondly, it’s amazing how quickly you’ve fixed the problem.

    I may have been a bit harsh since the bug hit me right at the deadline, but the author’s response delighted me.

    And yes, I’ve checked and now it’s working normally!
    Thanks!

    Thread Starter cvladan

    (@cvladan)

    Hi! I believe I’ve provided sufficient details, as I’m unsure how to explain more comprehensively. Should I mention that this involves Firefox, Windows and macOS, PHP7.4, and the latest WordPress? I think all these specifics won’t be of much help.

    As I’ve said, try anywhere to use the Spectra “Display conditions feature for the blocks” – the option “Day-You can select the days you want to disable.” Everything is clearly explained on the page https://wpspectra.com/docs/display-conditions-blocks/

    So, use that option on some core block, and then disable it. In the original post, you can see an example of what it looks like for core/group. Then look at resulting Gutenberg block code, even after not being used, or even if it wasn’t used but was just tampered with – why are there so many empty attributes left that should have been deleted?

    I can make a video if necessary? But I think it’s clear now.

    Thread Starter cvladan

    (@cvladan)

    Right now, nothing inside WordPress “Export” won’t work on PHP 8.1 due to an error in debug_log, and in that case, the download dialog doesn’t appear. However, it works perfectly on PHP 7.4.


    As for this plugin, when you set up Export functionality by reverting to PHP 7.4, it will not export new menus and navigation used in Block Gutenberg themes. Namely, the new navigation is stored in CPT wp_navigation, while this block will export the old one.

    Thread Starter cvladan

    (@cvladan)

    It may be important to note that both WordPress Address and Site Address are set to be in a subfolder. The same value is entered in both fields and the WP installation is actually located in that subfolder.

    image

    Thanks!

    I am having trouble understanding. It seems as though the two of you did not quite understand each other. Or perhaps it is I who did not understand?

    Because, I can easily reorder items in main menu
    I do not require the “collapse” feature, as drag and drop is working fine for me. Really having difficulty comprehending the issue at hand.

    Thread Starter cvladan

    (@cvladan)

    Thanks

    Forum: Plugins
    In reply to: [Duplicate Page] Warning?
    Thread Starter cvladan

    (@cvladan)

    Just did it. Mention me in changelog 😉

    Forum: Plugins
    In reply to: [Duplicate Page] Warning?
    Thread Starter cvladan

    (@cvladan)

    I will try. I will send you the link via that email.

    Thread Starter cvladan

    (@cvladan)

    Thanks. I see it’s merged in version 4.9.9.

    Thread Starter cvladan

    (@cvladan)

    Could you please let me know when you expect this small change to be merged? I noticed that it hasn’t been merged into v4.9.3 yet.

    Thanks!

    Thread Starter cvladan

    (@cvladan)

    Thanks!

    cvladan

    (@cvladan)

    I have created a single SQL command that reads all “reusable” blocks from all articles in a single pass, and creates a list of all articles in which the block is located. It also correctly counts the number of times the block appears and the total number of pages on which the block appears.

    Note that this query returns results in ALL articles, not just the first page of results, such as the first 20 or first 100.

    CREATE TEMPORARY TABLE results (post_id INT UNSIGNED, block_id INT UNSIGNED) ENGINE=MEMORY CHARSET=utf8mb4;
    DROP PROCEDURE IF EXISTS extractor;
    
    DELIMITER //
    
    CREATE PROCEDURE extractor() BEGIN
    
      DECLARE row_content, string, the_rest, pattern TEXT CHARSET utf8;
      DECLARE row_id, row_block INT UNSIGNED;
    
      DECLARE done BOOLEAN DEFAULT FALSE;
      DECLARE result CURSOR FOR SELECT id, post_content FROM wp_posts WHERE post_content LIKE '%<!-- wp:block {%' AND post_type NOT IN ('revision', 'attachment', 'nav_menu_item');
      DECLARE CONTINUE HANDLER FOR NOT FOUND SET done := TRUE;
    
      SET pattern = '<!-- wp:block {"ref":';
    
      OPEN result;
      loop_posts: LOOP
    
        FETCH result INTO row_id, row_content;
    
        IF done THEN
          LEAVE loop_posts;
        END IF;
    
        SET string = row_content;
    
        BEGIN
        loop_string:LOOP
    
          IF CHAR_LENGTH(TRIM(string)) = 0 OR string IS NULL OR LOCATE(pattern, string) = 0 THEN
            LEAVE loop_string;
          END IF;
    
          SET string= SUBSTRING(string, LOCATE(pattern, string) + CHAR_LENGTH(pattern));
          SET @temp = REGEXP_SUBSTR(string, "^\\d+\\D");
          SET @temp = LEFT(@temp, CHAR_LENGTH(@temp) - 1);
          SET row_block = CAST(@temp AS UNSIGNED);
    
          INSERT INTO results VALUES (row_id, row_block);
    
        END LOOP loop_string;
        END;
    
    
      END LOOP loop_posts;
    
      CLOSE result;
    END //
    
    DELIMITER ;
    
    CALL extractor();
    
    # Just IDs, grouped and sorted
    # SELECT block_id AS reusable_block_id, COUNT(post_id) AS number_of_block_occurrences, COUNT(DISTINCT post_id) AS number_of_pages_with_block, GROUP_CONCAT(post_id ORDER BY post_id) AS list_of_post_ids FROM results GROUP BY block_id;
    
    # All the data that we need for display: Post ID for a link, Post Title and Post Type, grouped and sorted
    SELECT block_id, CONCAT('[', GROUP_CONCAT(JSON_ARRAY(post_id, posts.post_title, posts.post_type) ORDER BY post_id), ']') FROM results LEFT JOIN wp_posts as posts ON results.post_id = posts.id GROUP BY block_id;
    
    # We could also use JSON_OBJECTAGG if we have some of later MariaDB/MySQL
    SELECT block_id, CONCAT('[', GROUP_CONCAT(JSON_ARRAY(post_id, posts.post_title, posts.post_type) ORDER BY post_id), ']') FROM results LEFT JOIN wp_posts as posts ON results.post_id = posts.id GROUP BY block_id;

    Note that this query will locate all reusable blocks in the content, including ones that are no longer present in the current WordPress installation.

    If you can, please test this SQL command in Adminer, for example, using the Adminer plugin. I am really interested in how much faster it is compared to the multitude of queries that WP currently sends. If it is significantly faster, it would make sense to incorporate this query into the plugin and I am sure the author of this plugin will do so. Or allow me to submit a PR for an improvement.

Viewing 15 replies - 1 through 15 (of 62 total)