How to display comments and comment form on custom post type?
1) add “comments” to the supports array when registering the post type. 2) add the comments_template() function inside the loop of the single.php template and you are good to go.
1) add “comments” to the supports array when registering the post type. 2) add the comments_template() function inside the loop of the single.php template and you are good to go.
Things you can check: View the page source, and look for your js files, if they’re included or not, and whether their order is proper. Use console.log(SwoonAjax.ajaxurl) to check if you’re getting the proper path in your js file. In Firebug, switch to Console tab, and then try firing your AJAX request. You’ll see the … Read more
If you plan to use it just for your own code, and have it running alongside WordPress’ default database driver (wpdb), I see no real problems. It’s only if you plan on fully integrating/overriding WP’s driver that I see it being near-impossible; hard-coded SQL is prolific throughout core, and translating them to ActiveRecord method calls … Read more
I agree with other answers that most of the time it is better to use a plugin to handle form submissions. However, there are exceptions to this rule. If you find yourself in a situation where you need to handle the form submissions yourself, you can submit data to admin-post.php. Here is how to set … Read more
<form action=”<?php echo esc_url( admin_url(‘admin-post.php’) ); ?>” method=”post”> <input type=”hidden” name=”action” value=”your_action_name”> Add these in your form. Where admin-post.php will process your form. In that case based on the value of your_action_name that is provided by you, an action hook will get involved. Say for example if you add a hook like the following in … Read more
If you read the documentation on wp_login_url, you can specify a redirect URL without having to use that hidden input field. Alternatively, you could just use the wp_login_form function to do exactly what you want: <?php wp_login_form(); ?> Just toss that in there in place of your form, and read the documentation on that function … Read more
My situation to tackle this problem was a bit problematic because I wanted to use the GF Update Post plugin to let my users edit their post right after they submitted the content. With the above solution ACF does not write to the db and correct ACF fields (at least not for me). My solution: … Read more
This class is used to visually hide elements from sighted users but still allows assistive technologies like screen readers to still present those elements to users who are visually impaired. For example you may have an icon with Facebook’s logo as a link to your page/profile. A sighted user will know that’s Facebook but a … Read more
This is my very simple implementation of contact form: class WPSE_299521_Form { /** * Class constructor */ public function __construct() { $this->define_hooks(); } public function controller() { if( isset( $_POST[‘submit’] ) ) { // Submit button $full_name = filter_input( INPUT_POST, ‘full_name’, FILTER_SANITIZE_STRING ); $email = filter_input( INPUT_POST, ’email’, FILTER_SANITIZE_STRING | FILTER_SANITIZE_EMAIL ); $color = filter_input( … Read more
Gravity Forms. Gravity Forms. Gravity Forms. http://www.gravityforms.com/purchase-gravity-forms/ Buy it, 40 bucks, it’s worth it over and over again. (Theres also a free demo)