wordpress-plugin

WooCommerce 2.6 - Hiding paid shipping when free shipping is triggered by reaching specific amount

两盒软妹~` 提交于 2019-12-05 00:38:23
问题 I recently updated to WooCommerce 2.6 on my shop and they have updated their shipping system. Before I used this to hide the paid shipping option when an specific order value was reached and free shipping was triggered: /** * woocommerce_package_rates is a 2.1+ hook */ add_filter( 'woocommerce_package_rates', 'hide_shipping_when_free_is_available', 10, 2 ); /** * Hide shipping rates when free shipping is available * * @param array $rates Array of rates found for the package * @param array

How to check if the current page is a plugin admin panel in wordpress

十年热恋 提交于 2019-12-05 00:24:27
问题 Please I want to know how to check if I'm currently in admin page of a plugin. I've created a plugin with a menu item which displays a page containing some stats of this plugin use, for that, I'm using custom JQuery plugins, some CSS, which I will never use outside of this page. So I wonder to know how can I check this, to enqueue or not plugin's styles and JSs . Here is my enqueue style code function bridge_style_enqueuer() { wp_register_style( "bridge_display_style", WP_PLUGIN_URL.'/symfony

Display product post type advanced custom field on recent orders template and admin orders (woocommerce)

孤者浪人 提交于 2019-12-04 23:31:10
I’m trying to display the fields I have created in the recent order template of WooCommerce and I’m not very knowledgeable in PHP. I have created a field called sessions and registered as a product post type. Once a user purchase a product I want thats customs fields "sessions" values to be displayed in the My account > Recent orders (template). I tried looking for answers and solutions and I seem to be stuck. Here is the customized code of my-order.php template that I have been working on. I have been hacking it for days and can't seem to display this values in my recent orders table. Updated

wordpress widget drag and drop not working after update to 3.5.1

廉价感情. 提交于 2019-12-04 21:59:33
I use ata-pp5 theme with wordpress for my site,recently after i update my wordpress to3.5.1 now the drag and drop feature in the widget area is not working..,i already try add Google Libraries plugin but it also did't work, Have you tried: => Deactivating all plugins to see if this resolves the problem. If this works, re-activate the plugins one by one until you find the problematic plugin(s). => Resetting the plugins folder by FTP or PhpMyAdmin. Sometimes, an apparently inactive plugin can still cause problems. I think this may help you to resolve your problem. Its because of some faulty

Adding two sidebars in wordpress child theme

折月煮酒 提交于 2019-12-04 21:36:01
In Wordpress I want to make two sidebars. One will be in left hand side of the content and the other one will be in the right hand side (default sidebar) in twentyelven theme. For that I made little bit customization to my twentyeleven child theme. In functions.php I made this changes register_sidebar( array( 'name' => __( 'Left Hand Sidebar', 'buygames' ), 'id' => 'sidebar-left', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => "</aside>", 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); Then in sidebar-page.php I added this code <div

How to filter category posts by date?

自作多情 提交于 2019-12-04 19:30:11
I am looking to have a drop down menu at the top of a category page that will allow me to then filter the posts by date. I will most probably have to make use of custom fields, but that isn't the issue. I know you can make a custom post query using GET style variables, but with pretty URLs enabled, I cannot seem to use the GET variables to filter specific posts (e.g. www.domain.com/category/?orderby=title&order=ASC etc etc ) I have tried looking for plugins, but nothing seems to jump out at me for what I need, and I have also noticed a lot of talk on here about similar subjects, with no decent

<fb:comments-count> not working on my WordPress powered blog

戏子无情 提交于 2019-12-04 18:34:22
I am using the Facebook comments plugin on WordPress and the comments box is working fine but I want to access the number of counts on the index page and on single pages. On the pages, the Facebook Javascript is loaded on the pages. Here's the code I used: <fb:comments-count href=<?php echo get_permalink() ?>/></fb:comments-count> comments But it doesn't count the FB comments. Is there a simple code that let me retrieve the number of comment counts? Thanks, ifennec Include this function somewhere in your template file : function fb_comment_count() { global $post; $url = get_permalink($post->ID

How do I check if email submitted via Contact form 7 exists in my database?

做~自己de王妃 提交于 2019-12-04 17:19:54
When customer submits email via contact form 7, how do I check if email already exists in my database and change notification message to "Your email already exists in our database" So far I have tried using before_send hook, but when I click submit, the page just hangs and no confirmation message. Below is the function I have in my functions.php add_action( 'wpcf7_before_send_mail', 'check_email' ); function check_email( $cf7 ) { $email = $cf7->posted_data["email"]; if($email == 'Is in our database'){ echo ('Your email exists in our database'); } } Thanks for your help d79 I've added a filter

remove published post notice while error handled

江枫思渺然 提交于 2019-12-04 17:10:35
im creating an error handler for a custom post type. add_filter( 'wp_insert_post_data' , 'filter_post_data' , '99', 2 ); function filter_post_data( $data , $postarr ) { //error handling if($data['post_type'] == 'post_annunci') { if($postarr['annuncio_prezzo'] == '' || !is_numeric($postarr['annuncio_prezzo'])) { $errors .= 'Annuncio non salvato, devi inserire un prezzo con valori numerici.</br>prezzo = '.$postarr['annuncio_prezzo']; update_option('my_admin_errors', $errors); $data['post_status'] = 'draft'; } } return $data; } add_action( 'admin_notices', 'admin_error_handler_annunci' );

Random permalink key in wordpress

末鹿安然 提交于 2019-12-04 17:05:03
I want to have a custom permalink for each new post in WordPress like: http://mysite.com/x5Kvy6 (like bit.ly). I tried this little script, but it adds only 5-digit numbers to the post title in the permalink. function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent ) { if($slug!=""){ $random=rand(11111,99999); //I needed 5 digit random $slug .= "-" . $random; } return $slug; } How can I make a random key instead of the post title? I have not researched URL shorteners or redirection methods. Any idea is welcome! function wp_unique_post_slug($col,$table='wp_posts'){