Created
August 19, 2023 08:01
-
-
Save ibrahim-kardi/f3c7bbb585ee48f80349610ffa8f0ff8 to your computer and use it in GitHub Desktop.
shortcode create wordpress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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