VoteMate embeds7 September, 2021 Uncategorized
A few days ago, someone asked me if it would be possible to embed VoteMate’s “Find Your Riding” feature into their WordPress site.
It wasn’t then.
But now it is:
Cool, right? Here’s the HTML:
<iframe src="https://votemate.org/canada2021/land/?a=webembed" style='width:100%;height:300px;border:none;border-radius:5px;'></iframe>
Why an HTML iframe?
While WordPress supports oEmbed, it only supports it for domains whitelisted in the WordPress code. That includes your usual list of social networks, but doesn’t include VoteMate. I could probably write a plugin that would whitelist VoteMate for your WordPress installation, but that seems a little overkill. Next election, perhaps!
How to use this?
If you’re using the fancy new WordPress block editor, just create a new block with the + button, and select “Custom HTML” for the block type. Then paste the above HTML.
If you’re using the old-fashioned WordPress editor, switch to Text mode (instead of Visual), and just paste the HTML where you want it.
You can customise the width and height parameters there to your heart’s content. I’d recommend using percentages wherever possible, so that the iframe will automatically adjust its size to fit the space its given.