Skip to content

Syntax for embedding an SVG from code with dimensions?  #20

@joemaller

Description

@joemaller

Shortcodes can embed registered SVGs with dimentions

For example:

[svg arrow height="20" width="24"]

will result in

<svg viewBox="0 0 25 10" width="24" height="20">...</svg>

But there's currently no way to do that from PHP without resorting to the very ugly, and presumably slow do_shortcode:

<?php echo do_shortcode( '[svg arrow height="20" width="24"]' ); ?>

I think I'd prefer to see arguments added to $SVG->embed('arrow'), probably an args object. (See also the syntax ideas for raw embeds in #19 )

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions