Response title
This is preview!
/*Add reply form slide out on BBPress*/
function show_form_on_click() {
$classes = get_body_class();
if ( is_user_logged_in() && !bbp_is_topic_closed() ) {
if (in_array('single-forum',$classes)) { ?>
<script type="text/javascript">
jQuery( document ).ready(function() {
jQuery( '<a class="custom-newtopic-button">Create Topic</a>' ).insertBefore( '#new-topic-0' );
jQuery('.custom-newtopic-button').click(function(){
jQuery('.custom-newtopic-button').hide();
});
jQuery('.custom-newtopic-button').click(function(){
jQuery('.bbp-topic-form').show();
});
});
</script>
<?php } elseif(in_array('single-topic',$classes)) { ?>
<script type="text/javascript">
jQuery( document ).ready(function() {
jQuery( '<a class="custom-reply-button">Reply</a>' ).insertAfter( '.bbp-pagination' );
jQuery('.custom-reply-button, .d4p-bbt-quote-link').click(function(){
jQuery('.custom-reply-button').hide();
});
jQuery('.custom-reply-button, .d4p-bbt-quote-link').click(function(){
jQuery('.bbp-reply-form').show();
});
});
</script>
<?php }
}
}
add_action( 'wp_footer', 'show_form_on_click' );
jQuery(document).mouseup(function (e)
{
var container = jQuery(".bbp_custom_links_submenu ");
if (!container.is(e.target) // if the target of the click isn't the container...
&& container.has(e.target).length === 0) // ... nor a descendant of the container
{
container.hide();
}
});
© 2013 jQuery Foundation
Sponsored by and others.