stats_jetpack_dashboard_widget

The Jetpack by WordPress.com stats jetpack dashboard widget function.

Description

stats_jetpack_dashboard_widget(); 

Usage

  1. if ( !function_exists( 'stats_jetpack_dashboard_widget' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'jetpack-by-wordpress-com/modules/stats.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = stats_jetpack_dashboard_widget(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/modules/stats.php  
  1. function stats_jetpack_dashboard_widget() { 
  2. ?> 
  3. <form id="stats_dashboard_widget_control" action="<?php esc_url( admin_url() ); ?>" method="post"> 
  4. <?php wp_nonce_field( 'edit-dashboard-widget_dashboard_stats', 'dashboard-widget-nonce' ); ?> 
  5. <input type="hidden" name="widget_id" value="dashboard_stats" /> 
  6. <?php submit_button( __( 'Submit', jetpack ) ); ?> 
  7. </form> 
  8. <span id="js-toggle-stats_dashboard_widget_control"> 
  9. <?php esc_html_e( 'Configure', jetpack ); ?> 
  10. </span> 
  11. <div id="dashboard_stats"> 
  12. <div class="inside"> 
  13. <div style="height: 250px;"></div> 
  14. </div> 
  15. </div> 
  16. <script> 
  17. jQuery(document).ready(function($) { 
  18. var $toggle = $('#js-toggle-stats_dashboard_widget_control'); 
  19.  
  20. $toggle.parent().prev().append( $toggle ); 
  21. $toggle.show().click(function(e) { 
  22. e.preventDefault(); 
  23. e.stopImmediatePropagation(); 
  24. $(this).parent().toggleClass('controlVisible'); 
  25. $('#stats_dashboard_widget_control').slideToggle(); 
  26. }); 
  27. }); 
  28. </script> 
  29. <style> 
  30. #js-toggle-stats_dashboard_widget_control { 
  31. display: none; 
  32. float: right; 
  33. margin-top: 0.2em; 
  34. font-weight: 400; 
  35. color: #444; 
  36. font-size: .8em; 
  37. text-decoration: underline; 
  38. cursor: pointer; 
  39. #stats_dashboard_widget_control { 
  40. display: none; 
  41. padding: 0 10px; 
  42. overflow: hidden; 
  43. #stats_dashboard_widget_control .button-primary { 
  44. float: right; 
  45. #dashboard_stats { 
  46. box-sizing: border-box; 
  47. width: 100%; 
  48. padding: 0 10px; 
  49. </style> 
  50. <?php