Now, with a shortcode for the single most powerful PHP function there is (preg_replace), I dare to imagine that there is nothing that this simple plugin cannot do.
If you know what this amazing function, preg_replace, is capable of then put it to the test.
Here is an example of the syntax for the new new shortcode that calls preg_replace:
[preg_replace replace=”/to be searched/” with=”I replaced”]<li>The content to be searched</li>[/preg_replace]
and this is what you get:
Hello,
How do I replace html tags?
e.g. [preg_replace replace="" with=""][/preg_replace] doesn’t work. I know my syntax is probably not correct. Could you tell me how to “escape” the syntax so that I obtain the correct function? Thanks!
Dude, I think this might work for you:
[preg_replace replace="/<.+?>/" with=""]<i>content</i> to be <b>replaced</b>[/preg_replace]
Can I change the order of html tag with this script?
I’m sure you could if you used the right regex with the right function. Can you give me an example of how you would use this?
Hello! Thanks again for this awesome plugin. Just wondered if it is still expected to work for WP 4+ at all?
Thanks!
Yes, It should work fine on WP 4.x, I have it working on a few of my own sites that have been upgraded to 4.0.1.
Thanks Eli! I can confirm it works too.
Love the plugin, it fits my needs almost perfectly. I’m trying to retrieve an image from sharefiles like this.
[remote_get url="http://www.shareimages.com/image.php?75704-pJOhl5SglpynlpyYng-il_spectroman.jpg"] it works, but it brings in the full page, with adverts, is there a way just to get the image?
Yes, just user the start and stop parameters to grab just the part of the HTML that you want from that page.
Thanks so much, I tried that and it worked, well it still left a little underneath, but far better than it was, so thanks again :)
Is there any way I could use this function to add the image as a featured image for the post?
No, I don’t think so, because the featured images are set in the database not in the dynamic code. But maybe you could hack you theme to call the shortcurl function in place of displaying the featured image, that would depend on your theme and your PHP skills ;-)
Hi,
I constantly ge the following error messages for all (4) durles sites, shown in WP Dashboard:
11-24 21:18: /wp-admin/post.php
SHORTCURL ERROR: wp_remote_get returned Array ( [ERROR] => WP_Error Object ( [errors] => Array ( [http_request_failed] => Array ( [0] => cURL error 28: Connection timed out after 10000 milliseconds ) ) [error_data] => Array ( ) ) )
any idea whats wrong or what I’m doing wrong?
Regards
Fiaskogaul
A consistent Connection timed error on a URL that does exist probably means that your server is not setup to make cURL calls or is blocking any outbound connections to that address.
ok thanks