Permalink
Browse files

Fix for Shortcode Issues

Shortcodes now come out of the text first and go back in first.  There
was some bugs causing content inside of shortcodes (images, headers) to
be replaced with the SEO auto linker shortcodes, but they weren't
getting replaces on the way back out.

http://wordpress.org/support/topic/headings-problem-when-seo-auto-linker-activated
  • Loading branch information...
1 parent 5a8351f commit 69e32f2437879ea1ea8eedbab377dbc1dfb721e0 @chrisguitarguy chrisguitarguy committed Aug 30, 2012
Showing with 22 additions and 16 deletions.
  1. +10 −10 inc/front.php
  2. +12 −6 wp-readme.txt
View
@@ -46,20 +46,20 @@ public static function content($content)
$shortcode_replacements = array();
$filtered = $content;
- preg_match_all('/<h[1-6][^>]*>.+?<\/h[1-6]>/iu', $filtered, $headers);
- if(!empty($headers[0]))
- {
- $header_replacements = self::gen_replacements($headers[0], 'header');
- $filtered = self::replace($header_replacements, $filtered);
- }
-
preg_match_all('/' . get_shortcode_regex() . '/', $filtered, $scodes);
if(!empty($scodes[0]))
{
$shortcode_replacements = self::gen_replacements($scodes[0], 'shortcode');
$filtered = self::replace($shortcode_replacements, $filtered);
}
+ preg_match_all('/<h[1-6][^>]*>.+?<\/h[1-6]>/iu', $filtered, $headers);
+ if(!empty($headers[0]))
+ {
+ $header_replacements = self::gen_replacements($headers[0], 'header');
+ $filtered = self::replace($header_replacements, $filtered);
+ }
+
preg_match_all('/<(img|input)(.*?) \/?>/iu', $filtered, $others);
if(!empty($others[0]))
{
@@ -107,11 +107,11 @@ public static function content($content)
$filtered = apply_filters('seoal_pre_replace', $filtered, $post);
- $filtered = self::replace_bak($link_replacements, $filtered);
- $filtered = self::replace_bak($header_replacements, $filtered);
$filtered = self::replace_bak($shortcode_replacements, $filtered);
+ $filtered = self::replace_bak($header_replacements, $filtered);
$filtered = self::replace_bak($other_replacements, $filtered);
-
+ $filtered = self::replace_bak($link_replacements, $filtered);
+
return apply_filters('seoal_post_replace', $filtered, $post);
}
View
@@ -1,10 +1,10 @@
-=== SEO Auto Linker ===
-Contributors: chrisguitarguy, agencypmg
-Donate link: http://www.pwsausa.org/give.htm
-Tags: seo, links, internal links, automatic linking
-Requires at least: 3.2
+=== SEO Auto Linker ===
+Contributors: chrisguitarguy, agencypmg
+Donate link: http://www.pwsausa.org/give.htm
+Tags: seo, links, internal links, automatic linking
+Requires at least: 3.2
Tested up to: 3.4
-Stable tag: 0.7.2
+Stable tag: 0.8
SEO Auto Linker allows you to automagically add links into your content. Great for internal linking!
@@ -47,6 +47,12 @@ In order to keep things simple, SEO Auto Linker searches for some common element
Nope. Because custom fields (aka `wp_postmeta`) can be used for so many different things, it doesn't make sense to automatically link that content.
+= Content inside of shortcodes isn't linked, what gives? =
+
+SEO Auto Linker ignores content inside of shortcodes. If you find yourself using shortcodes inside a theme to do things like columns, etc, you may be [doing it wrong](http://justintadlock.com/archives/2011/05/02/dealing-with-shortcode-madness).
+
+This was a deliberate decision and isn't likely to change.
+
== Screenshots ==
1. A look at the admin list of links

0 comments on commit 69e32f2

Please sign in to comment.