PGP-Encrypt system-generated notifications

There’s a small PGP plugin by Tim Nash on GitHub (but it’s not in the official WordPress repository, it needs to be manually copied to wordpress plugin directory). It’s a wrapper using php-pgp library for encryption. The article where I found this link is “Encrypting emails with PGP and WordPress”. This is the only WordPress … Read more

Woocommerce – Get product category 2nd level category

Assuming you know the parent category ID, you can use get_terms() function. $args = array( ‘parent’ => 100 // id of the direct parent ); $cats = get_terms( ‘product_cat’, $args ); foreach( $cats as $cat ) { echo $cat->name; } Here is more information on this function and additional arguments you can use. http://codex.wordpress.org/Function_Reference/get_terms

Dashboard Widget Form

That if(‘POST’…) just alone -in the middle of the plugin code- doesn’t seem right. You can hook into load-$pagenow and process the form submission there: add_action( ‘load-index.php’, ‘check_posted_data’ ); function check_posted_data() { if( ‘POST’ == $_SERVER[‘REQUEST_METHOD’] && !empty( $_POST[‘my_prefix_message’] ) ) { wp_die( “I’m here! {$_POST[‘my_prefix_message’]}” ); } } Please note that you’re missing security … Read more

Tracking Disqus comments on Google Analytics

You can use that snippet just anywhere where it can be rendered on single pages. For example, you can paste this under functions.php of your theme: function hook_disqus_config(){ if( ! is_singular() ) return; ?> <script type=”text/javascript”> function disqus_config() { this.callbacks.onNewComment = [function(comment) { _gaq.push([‘_trackEvent’, ‘Disqus’, ‘New Comment’, comment.id]); }]; } </script> <?php } add_action( ‘wp_footer’, … Read more

Ajax with jQuery UI dialog not working

Assuming your javascript and ajax action code are otherwise correct, target admin-ajax.php with the correct path by localizing your enqueued script: wp_localize_script( ‘your_script_handle’, ‘script_data’, array( ‘admin_ajax’ => admin_url( ‘admin-ajax.php’ ) ) ); Then in your javascript, reference that URL with: url: script_data.admin_ajax EDIT- ah, missed this the first time: $wpdb->feedmanager isn’t set unless you’ve explicitly … Read more

Distributing and packaging plugins

Well, not quite sure if I understood this, but I see that you want to ‘simulate’ pages using a plugin, and my best bet is to build your own posts on-the-fly using WordPress queries and rewrite rules. Let’s try this: Create a variable to respond to your view. add_action( ‘query_vars’, ‘add_query_vars’ ); function add_query_vars( $vars … Read more