Feature Request: Content Parameters/Arguments
-
Hello,
Writing to request the following feature:
The ability to add parameters to the shortcode that will replace text in the content. Like the following:
/* The Content Block content: */ Please enjoy this {{arg0}} coupon.
/* The post where the shortcode is used: */ [content_block slug=example-block arg0="50% off"]
/* The above two code blocks would then output: */ Please enjoy this 50% off coupon.
Here is code for a simple implementation of this feature–there is certainly a more elegant approach to this, but this is an example. This currently lives in the custom_post_widget_shortcode function in the foreach( $content_post as $post ) loop in post-widget.php.
for($i = 0; $i < 12; $i++) { if($atts['arg' . $i]) { $content = str_ireplace("{{arg" . $i . "}}", $atts['arg' . $i], $content); } }
Let me know your thoughts. Thank you for your plugin!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Feature Request: Content Parameters/Arguments’ is closed to new replies.