I want the page a molecule is embedded on to show up rather than the molecule itself. Is there a way to set it to noindex molecule pages?
]]>Great little plugin Marcus, but I’ve encountered a small bug.
Consider using [m id=”test” price=”$10.00″] when the test template is “Price: {price}”
You get in your output
Price: .00
Since this example is effectively processed using
preg_replace('/{price}/i', '$10.00', 'Price: {price}');
the $10 is interpreted by preg_replace as the 10th parenthesized match in the pattern – this means the $10 is stripped from the replacement string resulting in the price of .00.
If you try [m id=”test” price=”$100.00″], the output will be Price: 0.00 because the $n feature only allows n from 0 to 99, so $10 is stripped.
Not sure why you’re using preg_replace here since it is a simple string replacement, so I think you could use str_ireplace for this part of your code and avoid this problem.
Alternatively, you could replace $ in the replacement string with \$ before using preg_replace.
Tony
https://www.ads-software.com/extend/plugins/content-molecules/
]]>This is almost a handy feature of Content Molecules but it does, or will, lead to problems…
If an “unknown” ID slug is used within a Molecule shortcode the system appears to generate several “draft” Molecules. Several can become and endless amount as the system appears to generate a new draft each time the unknown ID slug is encountered, i.e. if the Molecule shortcode is within a template file, it appears that simply refreshing the frontend page that references the template will cause the system to create a new draft molecule. This happens whilst logged out of WordPress so, potentially, could lead to hundreds, or thousands, of draft Molecules being created.
Likewise, this problem also occurs with shortcodes with unknown ID’s being used with Pages or Posts.
I thought Content Molecules was the best Global Content plugin until I discovered this problem. This means it seems too dangerous to currently use outside of a test WP setup. I hope you find a solution.
https://www.ads-software.com/extend/plugins/content-molecules/
]]>