ACF Extended – Blocks vs Flexible Content

Using the ACF Extended plugin, what are the pros and cons of using Dynamic Block Types vs Dynamic Flexible Content?

Some points of comparison I would like considered:

  1. Ease of inputting data
  2. Previewing the component inside the back-end
  3. Wrestling with Gutenberg to get it to do what I want it to
  4. Gutenberg as a viable system in the future (I’ve heard some opinions on the negative side)

So far I’ve only used the base ACF Pro plugin w/ flexible content, but I’m wondering if I should invest time in Blocks.

Btw I’m not a theme author, I just develop custom websites.

Thanks!

Using 2 HTML blocks in Gutenberg to wrap content with div

I’m trying to wrap a Gutenberg block with a div with class x.

The structure I’m using looks like this:

  • HTML Block (<div class="x">)
  • Other Block(s)
  • HTML Block (</div>)

In the frontend, all works as expected, but in the Editor, when saving and reloading, it will popup the “This block contains unexpected or invalid content” error in both HTML blocks.

I assume the editor considers the code is wrong, cause the first one is not closed, and the second one is not open.
Is there another cleaner/better way of doing this? Shouldn’t I be able to write HTML in the blocks that are not necesserely self-contained?

mod security – ModSecurity CoreRuleSet blocks cloudflare ip instead of attacker

so I just finished setting up my new webserver with nginx 1.19.8 and modsecurity. Now I have found coreruleset and configured everything as I wanted. But I started testing the modsecurity anti dos feature and saw that it was blocking the cloudflare ip, instead of the real ip.

Does anyone have an idea why and do you have the same issue?

Best regards

Specify exact parent child relationship between two blocks

I have built two blocks for displaying a list of feature cards.

Block 1: Feature Cards (the container element)

(function (blocks, element, blockEditor) {
    var el = element.createElement;
    var InnerBlocks = blockEditor.InnerBlocks;

    blocks.registerBlockType('feature-cards', {
        title: 'Feature Cards',
        icon: 'universal-access-alt',
        category: 'layout',
        example: {},
        edit: function (props) {
            return el('div', { className: 'feature-cards' },
                    el(InnerBlocks)
            );
        },
        save: function (props) {
            return el('div', { className: 'feature-cards' },
                    el(InnerBlocks.Content)
            );
        },
    });
})(window.wp.blocks, window.wp.element, window.wp.blockEditor);

Block 2: Feature Card (the card itself with editable content)

(function (blocks, editor, element, blockEditor) {
    var el = element.createElement;
    var RichText = editor.RichText;
    var InnerBlocks = blockEditor.InnerBlocks;

    blocks.registerBlockType('feature-card', {
        parent: ('feature-cards'),
        title: 'Feature Card',
        icon: 'universal-access-alt',
        category: 'layout',
        example: {},
        attributes: {
            content: {
                type: 'array',
                source: 'children',
                selector: 'h3',
            },
        },
        edit: function (props) {
            var content = props.attributes.content;
            function onChangeContent( newContent ) {
                props.setAttributes( { content: newContent } );
            }
            
            return el('div', { className: 'feature-card' },
                        el('div', { className: 'feature-card__icon' }, el(InnerBlocks)),
                        el( RichText, {
                            tagName: 'h3',
                            className: 'feature-card__title',
                            onChange: onChangeContent,
                            value: content,
                        } )
                );
        },
        save: function (props) {
            return el('div', { className: 'feature-card' },
                        el('div', { className: 'feature-card__icon' }, el(InnerBlocks.Content)),
                        el( RichText.Content, {
                            tagName: 'h3',
                            className: 'feature-card__title',
                            value: props.attributes.content,
                        } )
                );
        },
    });
})(window.wp.blocks, window.wp.editor, window.wp.element, window.wp.blockEditor);

As you can see I have specified that the feature-cards are the parent for the feature-card so that the card blocks can only be used inside the parent block.

However there’s a couple of issues that I’m not sure how best to resolve:

First I want to make it so that the ONLY block that can be added as a child block of the feature-cards is the child block. How can I enforce this? As the parent block displays a grid with the expectation of the cards (so basically over blocks don’t work inside here).

Second as stated above the parent block displays a grid… but when inside the editor it seems WordPress adds some wrapper elements like:

enter image description here

Which causes the grid to break… is there anyway around this so that it displays correctly?

dnd 5e – Do skill bonuses in monster stat blocks include every modifier?

Skill bonuses are already baked into the stat blocks.

From the intro to the Monster Manual:

The Skills entry is reserved for monsters that are proficient in one or more skills. For example, a monster that is very perceptive and stealthy might have bonuses to Wisdom (Perception) and Dexterity (Stealth) checks.

A skill bonus is the sum of a monster’s relevant ability modifier and its proficiency bonus, which is determined by the monster’s challenge rating (as shown in the Proficiency Bonus by Challenge Rating table). Other modifiers might apply. For instance, a monster might have a larger-than-expected bonus (usually double its proficiency bonus) to account for its heightened expertise.

If the monster has proficiency in a particular skill, the total bonus to that check will be printed on the stat block. If it does not have proficiency, you just add the relevant ability modifier to the d20 result.

Simplifying code blocks with functions [Python]

Im searching for a way to simplify my code via functions. 90% of my operation are equal and only differ from the if condition.

E.g.

        if isFile:
            
            fFound = False
            for key in files:
                if item("path") in key:
                    fFound = True
                    for c in cmds.keys():
                        if item("path") in cmds(c)("files"):
                            ifxchecker(item("requiredIFX"), cmds(c)("ifx_match"))

                    outputCFG()

            if not fFound:
                notFound.append(item('path'))


        else:
            dir = item("path")(:-1)
            pFound = False
            for key in files:
                if dir in key:
                    pFound = True
                    for c in cmds.keys():
                        for file in cmds(c)("files"):
                            if dir in file:
                                ifxchecker(item("requiredIFX"), cmds(c)("ifx_match"))

                    outputCFG()

            if not pFound:
                notFound.append(dir)

My code is working fine, I’m just trying to get the most of it in a function and only differ from these small if conditions. I can’t find a way to simplify it and I’m not even sure if there is.

I did some small functions as you see but I think there would be a better way to simplify the whole construct.

magento2 – Invalid template file: ‘Company_module::menubtn.phtml’ in module: ” block’s name: ‘custom_menu’

I want display a phtml file in the header, i created a phtml file and called in the default.xml but it is giving invalid template file block’s name, what should be give as a block name

menubtn.phtml

<div class="headercustomlink">MENU</div>

default.xml

<referenceBlock name="header.container">
        <block class="MagentoFrameworkViewElementTemplate" name="custom_menu" after="-" template="Company_module::menubtn.phtml"/>
    </referenceBlock>

blocks – Magento 1.9 createBlock(‘catalog/product_list’) to show specific only products

Here is my code which show products based on specific category

echo $this->getLayout()->createBlock('catalog/product_list')
                        ->setData('category_id', '25')
                        // ->setAttribute('product_type', $category->getName(), 'text')
                        ->setData('column_count', '4')
                        ->setData('mode', 'grid')
                        ->setData('limit', '4')
                        ->setData('name', 'product_list')
                        ->setTemplate('catalog/product/checkout_list.phtml')
                        ->toHtml();

But what I am trying to implement is, say these are product ids 2,4 and Category Id 25 have products 1,2,3,4. So I would like to show only 2 product, but the above method shows all the 4 products. Any only can help me figure out this?

blockchain – Blocks from before the genesis block

The design of the blockchain is such that such a scenario is not possible. By definition, the genesis block does not have an ancestor block. While it has a field for the previous block hash, this field is set to all 0’s to indicate it is null and has no value set. This means that there are no blocks that come before the genesis block.

Additionally the genesis block is special in that it is both treated specially and hard coded into software. Nodes do not download the genesis block – they have the block in its entirety written into the software itself. This gives the genesis block special treatment, with one such special treatment being that the view of the blockchain is instantiated with the genesis block as the very first block.


While it is most certainly possible (and probable) that blocks were created before the genesis block, these blocks would have been ones that Satoshi created during testing and belong to a different blockchain. Those would not be valid on the Bitcoin blockchain because they refer to their own genesis block, or are their own genesis block. The actual time they were created does not matter, only whether they refer to blocks which eventually refer to Bitcoin’s genesis block.