Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ibrahim-kardi/f3c7bbb585ee48f80349610ffa8f0ff8 to your computer and use it in GitHub Desktop.
Save ibrahim-kardi/f3c7bbb585ee48f80349610ffa8f0ff8 to your computer and use it in GitHub Desktop.
shortcode create wordpress
<?php
/**
* Plugin Name: Demo Plugin
* Plugin URI: https://smalltowndev.com
* Description: A demo plugin to show how to WordPress.
* Author: kardi
* Version: 1.0.0
* Author URI: https://kardi.com
*
* @package wordpress-reset
*/
add_action( 'init', function() {
add_shortcode( 'demo-shortcode', 'demo_shortcode_render' );
} );
function demo_shortcode_render( $atts ) {
if ( $atts && isset( $atts['prompt'] ) ) {
$prompt = $atts['prompt'];
return "Hello {$prompt} World!";
}
return "Hello World!";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment