Thank you very much for the suggestion, and such useful links. I’ll study the benchmarks to see how I can improve PHP performance. These points are good to know!
There is definitely room for improvement. When I have some time, I’ll set up a benchmark test, and refactor the code based on the information you gave me. I’ll let you know how it goes, when I make the next update.
Nice. Another thing I just noticed.
I am making my first tests with the plugin and this
[loop type=”post” count=”3″ ][content][/loop]
In a current post with this example content
paragraph 1
[loop type=”post” count=”3″ ][content][/loop]
paragraph 2
paragraph 3
The plugin is displaying the loop content at the end of paragraph3 and not in the middle.
May be you should add “do_shortcode($out)” when returning the content in the “content” shortcode.
BR
Hmm, that’s interesting about the content being displayed at the end.
The [content] shortcode executes shortcodes within the post content by default. The end of that function goes:
if($shortcode_option != 'false') { // Shortcode?
$out = do_shortcode( $out );
}
return $out;
}
add_shortcode('content', 'custom_content_shortcode');
So, the issue must be somewhere else. Could it be with the CSS? Could it be how the [loop] shortcode displays the content..?
I’m not able to reproduce the issue – if you could let me see the page where this is occurring, I might be able to figure out what’s going on.
One possibility I just thought of: if you’re using the code [loop type="post" count="3"][content][/loop]
within a post, it could be trying to display the post itself, i.e., an infinite loop.
Hello
the do_shortcode
function should be placed within the loop
shortcode.
I.e. when you want that a shortcode correctly displays the content of a “child” shortcode you have to put the do_shortcode.
These are not your current functions but to explain it.
function loop(){
return do_shortcode( $content );
}
BR
By default, the [loop] shortcode executes shortcodes within the content that it wraps. There’s a line $output[] = do_shortcode($this->...)
for each post/attachment/etc that it finds.
So, I think the issue you’re experiencing must have a different cause. Sorry to hear that the plugin is not functioning as you expected. If you could let me know more details about the context in which you’re using the shortcodes, I might be able to figure out a solution.