-
Notifications
You must be signed in to change notification settings - Fork 0
Customization
Here is the list of customization.
Thread form is like below.
This form templates is located at 2ch/templates/thread-form.php
.
You can copy it to your theme's directory 2ch/thread-form.php
.
Child theme is also supported. Let's assume that your theme is child theme and parent theme has thread form:
- wp-content/themes/your-parent-theme
- 2ch/thread-form.php
- wp-content/themes/your-child-theme
- 2ch/thread-form.php
In this case, your-child-theme/2ch/thread-form.php
will be included.
Customizing thread template, your aim is to change it's appearance and just the CSS matters.
You can change most of all mark up of this template, but there remains something to be hold. The requirements list is below:
- Root form
form(class=nichan-thread, method=post, action=$endpoint)
- Each
input(name=post_title)
andtextarea(name=post_content)
- Submit button
input(type=submit)
. -
div.g-recapth
element for Google reCAPTCHA.
If you drop these requirements, thread form won't work.
Some variables are passed from plugin. If you are not familiar with PHP, leave them anyway.
If you decide copying template, please be careful for updating. Because we may change template structure, then your form may be broken. Read change log carefully and do update after confirming everything is O.K.
We check appearance of thread form on twentysixteen. CSS is very simple, but you may think it's obstacle for your theme.
You can stop loading CSS with filter.
// This filter just check CSS should be loaded.
// It's modest filter, isn't it?
add_filter( 'nichan_load_style', function( $load ) {
return false;
} );
That's it!
By default, every interactive action will be notified with Javascript's window.alert
.
It's not cool? So override it! For example, assume that you use Notify.js as global notification. This can be called like this:
$.notify('Hello World!', 'success');
Let's override 2ch's vanilla alert with it's cool stuff!
jQuery(document).ready(function($){
// Check if 2ch's JS exists
// You have to wait until document.ready,
// because it's loaed at footer bottom.
if( NichanVars ){
// Tell it alternative exists.
NichanVars.callback = true;
// And observe form message!
$(document).on('message.nichan', function(event, message, status, $form){
// status could be 'success' or 'error'.
$.notify(message, status);
});
}
});
=================================
Have any question? Please contact developer.