Skip to content

Instantly share code, notes, and snippets.

@AlexMcowkin
Last active August 29, 2015 14:17
Show Gist options
  • Save AlexMcowkin/b9b79ab7abcb4aa33518 to your computer and use it in GitHub Desktop.
Save AlexMcowkin/b9b79ab7abcb4aa33518 to your computer and use it in GitHub Desktop.
WP shortcodes: with params
<?php
// в посте добавить
[shortcodeName user="Alex" login="Phpist85"]
// в файле functions.php
function fncName($atrs)
{
$user = isset($atrs['user']) ? $atrs['user'] : 'EmptyUser'
$login = isset($atrs['login']) ? $atrs['login'] : 'EmptyLogin'
//body
return $output;
}
add_shortcode('shortcodeName', 'fncName');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment