Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Eliot Akira

    (@miyarakira)

    Thank you so much for these patches. I implemented them in the latest update, with also a short version of the parameter: fields.

    Expanding a list of fields to special tags is a brilliant idea. It reminds me of template tags in other CMS and languages. Also, I was impressed by your use of array functions, I learned something new. ??

    I hope you’ll excuse me for how huge the_loop_shortcode() is, more than a thousand lines.. Eventually I plan to break it down into a group of functions that filter the query. Both [loop] and [content] can be optimized further.

    Thanks again for the suggestions.

    Plugin Author Eliot Akira

    (@miyarakira)

    A couple of people pointed out that one of the patches throws a parse error on plugin activation. It was an issue with array_map, passing an anonymous function in the callback, not supported by PHP <5.3. I rewrote the line so that it calls a function declared separately. Not as compact and elegant, but now it’s compatible.

    Thread Starter k8n

    (@k8n)

    I am sorry about that. I’m a little rusty with PHP. Thanks for accepting the change request!

    Plugin Author Eliot Akira

    (@miyarakira)

    No problem at all, I actually preferred how your code was, so efficient.

    I’ve run into the same issue before with anonymous functions not being supported, and had to break up an elegant one-liner. PHP 5.3 came out five years ago, and it would seem all servers should have upgraded already – but, I learned that WordPress minimum requirement is 5.2.4. So, I need to keep this mind and ensure compatibility for future updates.

    Thank you for the new useful feature, I added an explanation in the reference for the loop shortcode.

    Plugin Author Eliot Akira

    (@miyarakira)

    Hello,

    I have an idea to deprecate a feature in exchange for better performance. Currently, there are predefined tags that are replaced by default inside the loop, like {TITLE} and {IMAGE_ID}.

    [loop type="post"]
      Predefined: {TITLE} and {IMAGE_ID}
    [/loop]

    This feature must perform a search for all predefined tags (about a dozen), for every loop – which is not so efficient.

    The change I’m thinking of making is, that only tags which are defined by the fields parameter will be replaced.

    [loop type="post" fields="id, image-id"]
      Specified by fields: {ID} and {IMAGE-ID}
      Not specified, will not replace: {TITLE}
    [/loop]

    This will be breaking backward compatibility, but it would cut down on unnecessary search-and-replace.

    I remembered this patch request, so wanted to ask your opinion. Are you still using field tags? If so, could you recommend a good way to deprecate the predefined tags being replaced by default? I just didn’t want to make a change that would affect any running shortcodes that rely on this feature.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Umm… How do I submit a patch for this thing?’ is closed to new replies.