Link7/automatic-content-spinner — pull request #28 by ramalveyra (2014-08-05 07:36:09+00:00)
Title: Pull request contains fixes to #27

This is related to https://github.com/Link7/wp-content-mixer/issues/29.
Prior to this request, the below example:
```
Content 1 {a|b|c}
Content 2 {a|b|c}
Content 3 {a|b|c}
```
works for the plugin and will generate:
![image](https://cloud.githubusercontent.com/assets/3870763/3808025/441e891e-1c71-11e4-8509-d3bd1e972c74.png)

This is because, the spinner by design, does not use shortcodes but instead spin the whole content (using filter 'the_content').

This however has a different result when called on a different plugin by using the plugin method ```spin_contents()```. If the spinner spin option is set to "domainpage" it will always use the same piece of content each time it encountered the same combination of string to spin.

To get around this, an added param as added called ```$addseed``` which can be added when calling the plugin method ```spin_contents()```. The ```$addseed``` param will serve as an addition to each new instance of a content to be rolled even if they have the same pieces of string.

Added code (in wp-content-mixer)::
```
if(class_exists('ContentSpinner')){
if($this->spinner === NULL)
$this->spinner = new ContentSpinner;
$custom_seed = $postid.$shortcode_index; //foreach new piece of content ($postid) . foreach shortcode call ($shortcode_index)
$content = $this->spinner->spin_contents($content, $custom_seed);
}
```
Example call
```
[content-mixer source="25:spinner:100%:3" min="3" max="3" spinoption="domainpage"]
[content-mixer source="25:spinner:100%:3" min="3" max="3" spinoption="domainpage"]
[content-mixer source="25:spinner:100%:3" min="3" max="3" spinoption="domainpage"]

[content-mixer source="25:test-spinner:100%:1" min="1" max="1" spinoption="domainpage"]
[content-mixer source="25:test-spinner:100%:1" min="1" max="1" spinoption="domainpage"]
[content-mixer source="25:test-spinner:100%:1" min="1" max="1" spinoption="domainpage"]
```
To check that it's working on domainpage, I have edited the slug of the page containing the above shortcodes:
test1.local.wordpress.dev/test-spinner-bug1:
![image](https://cloud.githubusercontent.com/assets/3870763/3808146/d744188e-1c72-11e4-8c4d-808746f4af96.png)

test1.local.wordpress.dev/test-spinner-bug5:
![image](https://cloud.githubusercontent.com/assets/3870763/3808156/f9e8cf88-1c72-11e4-99d6-759ed6f9e1a5.png)