Substring replacement for item-level substitution parameter

Sorry.

a href=…/anzeigebildernachparameter/?sk=[+iptc:2#025,single+]>[+iptc:2#025,single+] /a

  • This reply was modified 3 hours, 18 minutes ago by ernstwg.

Good to hear from you, and thanks for an interesting question.

As you discovered, the ,single format/option code precludes you from adding another formatting operation such as substring replacement. However, since the IPTC Keywords value is an array you can use an alternate notation to solve your problem.

You wrote “Filling the space with %20 manually…” You could use this notation instead:

[+iptc:2#025.0,str_replace(' ','%20')+]

The .0 array notation selects the first array element, just as the ,single format/option code would do. That allows you to add the ,str_replace(s,r) format/option code to do the replacement. That is not the best solution, though. A better (and simpler) alternative is:

[+iptc:2#025.0,url+]

The ,url format/option code will ensure that all special characters are converted to a URL-safe equivalent. For example, spaces are replaced by the plus character (+) as the URL standard specifies.

I hope that solves your problem. I am marking this topic resolved, but please update it if you have problems or further questions regarding the solution outlined above. Thanks for your long-standing interest in the plugin.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Your Advertisement Here