create shortcode that changes url endpoint

it’s hard for me to say if the remote API allows you to get stats for given player only, but… There’s another way and I would go for it just to minimize the number of requests to remote API… class Remote_Player_API { private static $instance; private $remote_data; public static function init() { if ( ! … Read more

Changing Date Format on Custom Meta Data w/shortcode call

Try with change line to date(‘d-m-Y’,strtotime($current_user->delivery_date)) ; function delivery_date( $atts ) { global $current_user, $user_login; get_currentuserinfo(); add_filter(‘widget_text’, ‘do_shortcode’); if ($user_login) return date(‘d-m-Y’,strtotime($current_user->delivery_date)) ; } add_shortcode( ‘delivery_date’, ‘delivery_date’ ); echo do_shortcode(‘[delivery_date]’);

return an array with a shortcode

Shortcode should return string ready to append to content. You can’t return an array, because it won’t be printed correctly. So if your shortcode should return an array, you have to figure out how this data should be formatted. One way to do it is to use commas to separate the values: return implode( ‘, … Read more

How to return html as a string from php for WordPress

You are missing multiple single quotes around $a[url], so after src=”https://wordpress.stackexchange.com/questions/350229/ there should be a” and after $a[url] there should be another single quote, and you also need to quote the array key, so the whole return line should be return ‘<audio class=”listen” preload=”none” data-size=”250″ src=”‘ . $a[‘url’] . ‘”></audio></div></div>’;

How to use code in an editor block?

The easy way would be to create a Shortcode in the functions.php file of your theme and then use it in Gutenberg. Gutenberg has a built-in block to add shortcodes. Basically, you will add the following code to your functions.php file, function get_forum_post_information( $atts ) { // The PHP Code that you want to execute … Read more