How to create a checkbox to show/hide a field in WooCommerce checkout [closed]

Put this code in functions.php file. add_filter( ‘woocommerce_checkout_fields’ , ‘rws_display_checkbox_and_new_checkout_field’ ); function rws_display_checkbox_and_new_checkout_field( $fields ) { $fields[‘billing’][‘have_vat_number’] = array( ‘type’ => ‘checkbox’, ‘label’ => __(‘Are you have Vat Number?’, ‘woocommerce’), ‘class’ => array(‘form-row-wide’), ‘clear’ => true ); $fields[‘billing’][‘vat_number’] = array( ‘label’ => __(‘Vat Number’, ‘woocommerce’), ‘placeholder’ => _x(‘Vat Number’, ‘placeholder’, ‘woocommerce’), ‘class’ => array(‘form-row-wide’), ‘clear’ … Read more

Find Total Authors

Hi @rsm: There are probably better ways, using the WordPress API, but since I know SQL so well this immediately came to mind: function total_published_authors() { global $wpdb; $sql =<<<SQL SELECT COUNT(*) AS total_published_authors FROM ( SELECT DISTINCT {$wpdb->users}.ID FROM {$wpdb->users} INNER JOIN {$wpdb->posts} ON {$wpdb->posts}.post_author={$wpdb->users}.ID WHERE {$wpdb->posts}.post_status=”publish” GROUP BY {$wpdb->users}.ID ) x SQL; return … Read more

Numbering lines of code with the tag?

To get syntax highlighting with line numbering, you’ll need to use a plugin like SyntaxHighlighter Evolved. In fact, looking at the source of that second link, it appears that they are using SyntaxHighlighter Evolved themselves.

Loop don’t work within single.php page

To give you a more thorough answer I would have to see some actual code, but I think the gist of the answer is in the file you are trying to use. “single.php” is the template file used to display the content of a single post, as the name implies. It isn’t meant for displaying … Read more

WordPress code editor messed up my code!

This isn’t as good as line numbers but you can add a dummy class every so often. #_________section_1 { display: none; /* Just in-case it strips the empties */ }; It may help you to quickly scroll to the relevant section. To be honest though, you should have a mirror of your site stored locally … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)