index.php 994 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /*
  3. Plugin Name: Sahifa Box'em'all
  4. Plugin URI:
  5. Description: Permette di ottenere dei box in stile sahifa per le pagine usando uno shortcode, se usato con il plugin all-in-event-calender con il medesimo modo si possono anche ottenere dei box di eventi.
  6. Version: 0.1
  7. Author: gin(e)
  8. Author URI: http://ginex.indivia.net
  9. License: BSD(3-clause) Licence
  10. */
  11. /*Intercetto lo shortcode*/
  12. add_shortcode('sbea', 'sbea_inject_box');
  13. function sbea_inject_box($attrs){
  14. if( is_home() &&
  15. isset($attrs['type']) && isset($attrs['ids'])){
  16. if($attrs['type']=='page'){
  17. require_once 'page_box.php';
  18. get_page_box($attrs);
  19. } else if ($attrs['type']=='event') {
  20. require_once 'ai1ec_box.php';
  21. get_ai1ec_box($attrs);
  22. }
  23. }
  24. }
  25. /*Carico il css personalizzato*/
  26. add_action( 'wp_enqueue_scripts', 'sbea_load_scripts' );
  27. function sbea_load_scripts($attrs){
  28. if( is_home()) {
  29. wp_register_style( 'sbea_css', plugins_url( 'css/sbea.css', __FILE__),false,true );
  30. wp_enqueue_style( 'sbea_css' );
  31. }
  32. }