• Resolved KZeni

    (@kzeni)


    First off, thank you for the great plugin and I just have a quick suggestion for the next update.

    My Thought
    Many/most people using WordPress for their site aren’t programmers so they’re not well versed on what an integer is and what a string is (and why that matters). They just see that shortcodes commonly have their values wrapped in quotes. This becomes a problem when this plugin requires that some of the attributes being set can’t use quotes while others should use quotes.

    Suggestion
    Therefore, I propose this plugin should allow [post-content id="25"] to work rather than requiring [post-content id=25] (which should still work). The goal is to follow the principle of accepting user input where you should accept a variety of inputs that then all work as the user would expect rather than forcing technical conventions upon them that they need to learn (and have things break unless followed).

    How to Implement
    I’m not familiar with this plugin’s code base & I don’t see a way to easily submit change requests, but I’d suspect that any shortcode attribute that needs to be an integer should have a line in the plugin that auto-converts the user-provided value into an integer. Thus, making this plugin accept all attribute values with quotes.

    I know this might be tricky when determining category on post-list, but you could see if it’s able to be converted to an integer and determine if it’s a name or ID from there. It seems that’s the only attribute where it accepts both strings & integers.

    Thanks for hearing me out!

    https://www.ads-software.com/plugins/post-content-shortcodes/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter KZeni

    (@kzeni)

    Come to think of it this should be the case for boolean attributes as well as integers. People should be able to use [post-content id="25" shortcode="true"] for the same reasons I mentioned above.

    Thanks again.

    Plugin Author Curtiss Grymala

    (@cgrymala)

    Thanks for the suggestion. Do you have specific examples of when this isn’t working for you with this plugin?

    The boolean values should all work as expected (the attributes are run through a function that looks for 1, '1', 'true' or true; and 0, '0', 'false' and false, and sets the value accordingly. Thank you.

    Thread Starter KZeni

    (@kzeni)

    It wasn’t working at the time this was written, but I just checked the same exact site where this was an issue and it is no longer experiencing the problem. It’s now running the latest version of WordPress (4.2.2) and the latest version of this plugin (0.5). At the time, I’m guessing it was running WordPress 4.1.x and probably version 0.4.1 of this plugin.

    So, it seems it’s no longer an issue with this site. That said, in general, automatic type setting isn’t a guarantee. WordPress wants IDs to be presented as integers, and so running intval() on values that should be integers would help with overall compatibility. Though it does seem to no longer be an issue with my site with everything being up-to-date (which I can’t speak to what exactly fixed the issue, necessarily).

    Thanks for the follow up!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Suggestion: Allow for post-content's id (among other attributes) to use quotes’ is closed to new replies.