';
$output .= '
';
foreach($anchors as $anchor):
$label = str_replace(array('-','_'),' ', $anchor);
$output .= '- ';
$output .= ''.$label.'';
$output .= '
';
endforeach;
$output .= '
';
$output .= '';
return $output;
}
function benjamin_sticky_sidenav($id = 0){
if($id == 0)
return false;
echo benjamin_get_sticky_sidenav($id); // WPCS: xss ok.
}
function benjamin_sticky_sidenav_anchors($id) {
$post_content = get_post($id);
$content = $post_content->post_content;
$pattern = '(id="([a-zA-z0-9\-]+)"+)';
preg_match_all($pattern, $content, $matches);
if( 2 == count($matches) > 1 )
return $matches[1];
else
return false;
}