Currently I’m developing a gallery plugin for WordPress, and I would like to give my users the option to choose the gallery’s position (before or after the_content).
Currently, I have succeeded to put it after the content, by hooking into the_content like this:
function add_post_content($content) {
if ( 'gallery' == get_post_type() && is_single() ) {
$content .= gallery_frontend();
$content .= gallery_map_display();
}
if ( 'gallery' == get_post_type() && is_archive() ) {
// archive functions here
}
return $content;
}
add_filter('the_content', 'add_post_content');
Is there any way to get it to display before the_content in stead of after?
Could you not just concatenate in the other direction?
I am not sure what your functions do, but if they just return string data then this should work fine.
http://php.net/manual/en/language.operators.string.php