Site logo

Archived topic

Creating a Shortcode

3 replies · Started by Nahuel on November 14, 2018

Viewing posts 1–4 of 4

How can I create a shortcode for this:

(<)div class="videoWrapper"(>)
Your video embed code
(<)/div(>)

For this style:

.videoWrapper {
position: relative;
padding-bottom: 56.25%; /* 16:9 */
padding-top: 25px;
height: 0;
}
.videoWrapper iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

Hi there,

Not quite sure if I understand. The code is for making videos responsive so you don't need shortcode for this.

Everytime you want to add a video, simply add this HTML:

<div class="videoWrapper">
    Your video embed code
</div>

And you only have to add the CSS once:

.videoWrapper {
	position: relative;
	padding-bottom: 56.25%; /* 16:9 */
	padding-top: 25px;
	height: 0;
}
.videoWrapper iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

So I don't really see any advantage of using shortcode.

It's true, but I wanted a friendly code for new users.
Es verdad, pero quería un código amistoso para los nuevos usuarios.

Thanks for your reply.

No problem :)

This archived topic is closed to new replies.