Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use shortcode_atts in `wp_biblelink_shortcode() #4

Open
paulgibbs opened this issue Mar 18, 2014 · 0 comments
Open

Use shortcode_atts in `wp_biblelink_shortcode() #4

paulgibbs opened this issue Mar 18, 2014 · 0 comments

Comments

@paulgibbs
Copy link
Contributor

In wp_biblelink_shortcode(), you currently parse a string like "John 3:16" and split that up into relevant parts. While this works, it's a bit of a brittle approach in case you ever decide to change the input format, and though this might seem an obvious input format to you, perhaps it mightn't be for others?

A more conventional way for shortcodes to accept multiple parameters is to use WordPress' Shortcode_API() function. The shortcode could look something like [bible book="1samuel" chapter="1" verse="1"]. See https://codex.wordpress.org/Shortcode_API for documentation and more examples.

If you think specifying the input as "John 3:16" is absolutely the way to go, I'd still recommend first using the shortcodes attributes function to parse the input, and then we can re-implement parsing simple strings such as "John 3:16" against that -- happy to help with advice when you get there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant