How To Customize Position of »add to cart« of WooCommerce on Product Page [closed]

You can do what you want by hooking into the woocommerce_single_product_summary action. The action is executed inside content-single-product.php like this: <?php /** * woocommerce_single_product_summary hook * * @hooked woocommerce_template_single_title – 5 * @hooked woocommerce_template_single_price – 10 * @hooked woocommerce_template_single_excerpt – 20 * @hooked woocommerce_template_single_add_to_cart – 30 * @hooked woocommerce_template_single_meta – 40 * @hooked woocommerce_template_single_sharing – … Read more

Add comments meta fields to comments metabox on post edit screen

Unfortunately the hooks: manage_{$this->screen->id}_columns manage_{$this->screen->id}_sortable_columns manage_comments_custom_column are not available for the post-comments list table, constructed within the wp_ajax_get-comments call. That table consists only of two columns: author and comment. The data for author, avatar, email, url and IP is displayed in the first column. We can on the other hand use a hack like: add_filter( … Read more

Prevent duplicate posts in wp_insert_post using custom fields

To save the link in the post meta you can use update_post_meta like this for example: $url = “http://sample.com/entertainment/default.aspx?tabid=2305&conid=102950” $my_post = array( ‘post_title’ => “$title”, ‘post_content’ => “$content”, ‘post_status’ => ‘draft’, ‘post_author’ => 1, ‘post_category’ => array(1), ); $post_id = wp_insert_post( $my_post ); update_post_meta($post_id,’source_link’,$url); and to prevent the insertion add a simple conditional check: $args … Read more

How to add users roles dropdown in registration in wordpress

https://codex.wordpress.org/Customizing_the_Registration_Form https://codex.wordpress.org/Function_Reference/wp_update_user Instead of update_user_meta function in user_register hook use wp_update_user Following is the working example: //1. Add a new form element… add_action( ‘register_form’, ‘myplugin_register_form’ ); function myplugin_register_form() { global $wp_roles; echo ‘<select name=”role” class=”input”>’; foreach ( $wp_roles->roles as $key=>$value ) { // Exclude default roles such as administrator etc. Add your own if ( … Read more

Showing current taxonomy terms

try this: <?php get_header(); ?> <? // get the current term $term = get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ ) ); <div class=”container” role=”main”> <h1 class=”entry-title”><?php echo $term->name; ?></h1> <div class=”entry-content ref”> <?php $loop = new WP_Query( array( ‘post_type’ => ‘references’ , ‘genre’ => $term->slug) ); ?> <?php while ( $loop->have_posts() ) : $loop->the_post(); … Read more

TinyMCE style_select – Append Classes

EDIT The quick and easy method is just a simple setting: style_formats_merge… function myformatTinyMCE($in) { $style_formats = array( array( ‘title’ => ‘Classes’, ‘items’ => array( array( ‘title’ => ‘Blue Color’, ‘selector’ => ‘p,strong,u,em,ol,ul’, ‘classes’ => ‘blueColor’ ) ) ) ); $in[‘style_formats_merge’] = true; $in[‘style_formats’] = json_encode( $style_formats ); return $in; } add_filter(‘tiny_mce_before_init’, ‘myformatTinyMCE’ ); Everything … Read more