• Alex

    (@itutorialro)


    Hi,

    For every post with images in body, the Facebook Instant Articles plugin shows me the following warning:

    No rules defined for <img class="aligncenter size-full wp-image-xxxxx"> in the context of Anchor

    Unfortunately, the image is not showing in the instant article.

    How may I fix this issue? I mention that I have installed the latest version of Instant Articles Plugin for WP, 3.1.2.

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • hi, i’m experiencing the same warning. The xxxx is post-id which is dynamic.

    i tried to insert this code, but no luck.

    {
        "rules":
        [{
            "class": "AnchorRule",
            "selector": "a",
            "properties": {
                "anchor.href": {
                    "type": "string",
                    "selector": "a",
                    "attribute": "href"
                },
                "anchor.img": {
                    "type": "string",
                    "selector": "img.size-medium alignleft wp-image-",
                    "attribute": "src"
                },
                "anchor.rel": {
                    "type": "string",
                    "selector": "a",
                    "attribute": "rel"
                }
            }
       }]
    }

    I’m using WP 4.6.1, PHP 5.5.9.

    apparently, the problem is if we set the image with link to : none. (it’s all fine).
    IMO, this is what plugin’s developer should see.

    • This reply was modified 9 years, 7 months ago by afjsystem.

    Maybe i could help, i set this custom transformer rules

    {
    “class”: “ImageRule”,
    “selector”: “//p[img]|//p[a[img]]|//a[img]|//div[img]”,
    “properties”: {
    “image.url”: {
    “type”: “string”,
    “selector”: “img”,
    “attribute”: “src”
    }
    }
    },

    that works with combinations of images and paragraphs, paragraphs and links, links and divs.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘No rules defined for image’ is closed to new replies.