Tagged Questions
1
vote
1answer
91 views
Processing shortcodes in groups (separated by line breaks)?
The Project
I'm working on a plugin to resize and embed rows of images using shortcodes that will be converted into <img> tags. In most cases there will be multiple images per row, and the ...
1
vote
3answers
148 views
Getting attribute value from shortcode
I have this shortcode
[learn_more caption="something here:"]
[/learn_more]
I want to extract the caption value and remove other stuff. "something here:"
This is the code that I have, but it ...
-1
votes
2answers
122 views
Get URL from shortcode tag
I am running a wordpress site and I need the correct regex syntax to get a URL from some shortcode that is returned inside the_content().
When I use the_content(), it will return something like ...
2
votes
3answers
205 views
get attributes/part of the gallery shortcode
I'm trying to grab all image id's that are associated with the [gallery] shortcode that are listed as exclude. For example: if my post has [gallery exclude="1,2,3"] I'd like to get a variable that ...
1
vote
1answer
608 views
extract shortcodes from string
i need a little help to with this issue:
I have a string wich contains shortcodes like [shortcode data="1" data2="2"]
How I can extract with regex? without wordpress system?
Thanks in advance.
0
votes
2answers
155 views
How to deal with Wordpress bug: can't use wrapped and unwrapped shortcode on same post
After trouble parsing wrapping and non-wrapping shortcodes on the same page, I came across this trac ticket from 3 years ago: http://core.trac.wordpress.org/ticket/9264
The trouble is WP cannot ...
0
votes
1answer
366 views
get_shortcode_regex() only matches first shortcode
The Codex has an example of using get_shortcode_regex() to check if a shortcode is being called on a given page:
$pattern = get_shortcode_regex();
preg_match('/'.$pattern.'/s', ...
4
votes
3answers
936 views
Nested Shortcode Detection
If you are familiar with this code
<?php
$pattern = get_shortcode_regex();
preg_match('/'.$pattern.'/s', $posts[0]->post_content, $matches);
if (is_array($matches) && $matches[2] ...