stats_jetpack_dashboard_widget

Jetpack Stats Dashboard Widget.

Description

stats_jetpack_dashboard_widget(); 

Usage

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