Error: Missing "shortcode" attribute in the shortcode.'; } $shortcode = $atts['shortcode']; // Get the shortcode from the attribute // Generate the shortcode tag $shortcode_tag = '[' . $shortcode; // Add any other attributes to the shortcode foreach ($atts as $attribute => $value) { if ($attribute !== 'shortcode' && $attribute !== 'class') { $shortcode_tag .= ' ' . $attribute . '="' . $value . '"'; } } $shortcode_tag .= ']'; // Execute the shortcode and capture its output $shortcode_output = do_shortcode($shortcode_tag); // Escape the output for safe display $escaped_output = esc_html($shortcode_output); // If content is passed, display it instead if ($content) { $escaped_output = esc_html($content); } // Add custom class if provided $class_attribute = !empty($atts['class']) ? ' class="' . esc_attr($atts['class']) . '"' : ''; // Return the shortcode with output and custom class return '' . $escaped_output . ''; } add_shortcode('aio_shortcode', 'display_aio_shortcode');