Skip to content

Instantly share code, notes, and snippets.

@jerrickhakim
Last active April 19, 2018 02:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jerrickhakim/d81eae7ab53bbc1b4515e333000c1c39 to your computer and use it in GitHub Desktop.
Save jerrickhakim/d81eae7ab53bbc1b4515e333000c1c39 to your computer and use it in GitHub Desktop.
HTML To Shortcode WordPress
function register_my_shortcode() {
ob_start(); ?>
<div class="my-shortcode">
<h1>Hi, I am the shortcode.</h1><hr />
<p>This is a screenshot of how I was created!</p>
<img src="https://d153h1xtzgec02.cloudfront.net/shortcode-function-blog-post.png" alt="Function Screen Shot">
<p>I was created by pasting &#x5b;shortcode_name] on this post!</p>
</div>
<?php
return ob_get_clean();
}
add_shortcode ('shortcode_name', 'register_my_shortcode' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment