Insert HTML just after tag

Twenty Twelve does not have any hooks that fire immediately after the opening <body> tag. Therefore you in your child theme which extends the parent Twenty Twelve theme, copy the header.php across to your child theme directory. Open the header.php file in your child theme and just after the opening body tag add an action … Read more

How to reorder billing fields in WooCommerce Checkout template? [closed]

Same can be done through functions.php in your (child) theme: add_filter(“woocommerce_checkout_fields”, “order_fields”); function order_fields($fields) { $order = array( “billing_first_name”, “billing_last_name”, “billing_company”, “billing_address_1”, “billing_address_2”, “billing_postcode”, “billing_country”, “billing_email”, “billing_phone” ); foreach($order as $field) { $ordered_fields[$field] = $fields[“billing”][$field]; } $fields[“billing”] = $ordered_fields; return $fields; }

Explanation for apply_filters function and its variables

That line is using two different functions that need two separate explanations. __() This is a translation function. If the settings are done right, it will translate the first parameter from a list of pre-translated strings. If an installation has a file with a compiled translation for this function to use, it will use it. … Read more

what is __return_false in filters

WordPress contains built in functions for quickly returning values. They are intended to be used as a quick built in function that returns a common value to a filter hook such as true, false, or an empty array. __return_false — Returns the Boolean value of false. __return_true — Returns the Boolean value of true. __return_empty_array … Read more

Remove classes from body_class

You can configure the $whitelist array in this function to filter out all other unwanted classes. add_filter( ‘body_class’, ‘wpse15850_body_class’, 10, 2 ); function wpse15850_body_class( $wp_classes, $extra_classes ) { // List of the only WP generated classes allowed $whitelist = array( ‘portfolio’, ‘home’, ‘error404’ ); // Filter the body classes $wp_classes = array_intersect( $wp_classes, $whitelist ); … Read more

Add custom options to the wplink dialog

The dialog HTML comes from WP_Editors::wp_link_dialog() but no hooks in there. We could instead use jQuery to append the custom HTML to the link dialog and try to override e.g. the wpLink.getAttrs(), because it’s very short 😉 Demo example: jQuery( document ).ready( function( $ ) { $(‘#link-options’).append( ‘<div> <label><span>Link Class</span> <select name=”wpse-link-class” id=”wpse_link_class”> <option value=”normal”>normal</option> … Read more

How can I modify the WordPress default widget output?

To expand on Mark’s answer, there’s not much (generally) available in the way of filters in the default WordPress widgets (except for perhaps widget_text). But adding your own custom widget is easy – put this in your functions.php: require_once(“my_widget.php”); add_action(“widgets_init”, “my_custom_widgets_init”); function my_custom_widgets_init(){ register_widget(“My_Custom_Widget_Class”); } Then you simply want to copy the existing categories widget … Read more

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