I ponder methods to obtain outputbuffering in chunks when utilizing a shortcode?
With out outbuffering:
(This works and will get at right location (beneath the precise header in template due to return $html;)
add_shortcode( 'showtable', array ( $this, 'source_to_table') );
perform source_to_table( $attrs )
{
code...
$html="";
for($row_values as $r) {
$html .= $r . '<br>';
}
return $html;
}
With outbuffering:
(This works however is positioned immediately at high (earlier than the precise header in template as a result of no return exists. but when I’ve a return then complete level of utilizing output buffering chunks are gone!?)
add_shortcode( 'showtable', array ( $this, 'buffered_source_to_table') );
perform buffered_source_to_table( $attrs )
{
code...
$chunk = 0;
for($row_values as $r) {
ob_start();
echo $r.'<br>';
$chunk++;
if ($chunk % 100 == 0) ob_flush();
}
ob_flush();
}