Hej,
dostałem za zadanie zrobienie plugina do wordpressa.
Napisałem ale nie chcą go przyjąć i dodać do pluginów na stronit wordpress.org o to co piszą:
Kod
== Calling wp-load.php directly ==

Including wp-config.php, wp-blog-header.php, wp-load.php, or pretty much any other WordPress core file that you have to call directly via an include is not a good idea and we cannot approve a plugin that does so unless it has a very good reason to load the file(s). It is prone to failure since not all WordPress installs have the exact same file structure.

Usually plugins will include wp-config.php or wp-load.php in order to gain access to core WordPress functions, but there are much better ways to do this.

It's best if you tie your processing functions (the ones that need but don't have access to core functions) into an action hook, such as "init" or "admin_init".

Please consult the Plugins API reference for more information: http://codex.wordpress.org/Plugin_API

If you're trying to use AJAX, please read this: http://codex.wordpress.org/AJAX_in_Plugins


Tak wygląda kod pluginu:
  1. <?php
  2. if ( is_admin() && ( !defined( 'DOING_AJAX' ) || !DOING_AJAX )) {
  3.  
  4. add_action('admin_menu', 'show_print_button_options');
  5. function show_print_button_options() {
  6.  
  7. // Adding a new submenu
  8.  
  9. add_options_page('Printer-Friendly WP Options', 'Printer-Friendly WP', 'manage_options', 'print_postpage_comments', 'print_button_options');
  10.  
  11. //Add options
  12.  
  13. add_option('print_button_posts', 'on');
  14. add_option('print_button_pages', 'off');
  15.  
  16. }
  17.  
  18. //
  19. // Admin
  20. //
  21. function print_button_options() { ?>
  22. <style type="text/css">
  23. div.headerWrap { background-color:#e4f2fds; width:200px}
  24. #options h3 { padding:7px; padding-top:10px; margin:0px; cursor:auto }
  25. #options label { width: 300px; float: left; margin-left: 10px; }
  26. #options input { float: left; margin-left:10px}
  27. #options p { clear: both; padding-bottom:10px; }
  28. #options .postbox { margin:0px 0px 10px 0px; padding:0px; }
  29. </style>
  30. <div class="wrap">
  31. <form method="post" action="options.php" id="options">
  32. <?php wp_nonce_field('update-options') ?>
  33. <h2>Printer-Friendly WP</h2>
  34.  
  35. <div class="postbox-container" style="width:100%;">
  36.  
  37. <div class="metabox-holder" style="float: left;width:100%;">
  38. <div class="postbox">
  39. <h3 class="hndle"><span>Settings</span></h3>
  40. <div style="margin:20px;">
  41. <p>
  42. <?php
  43. if (get_option('print_button_posts') == 'on') {echo '<input type="checkbox" name="print_button_posts" checked="yes" />';}
  44. else {echo '<input type="checkbox" name="print_button_posts" />';}
  45. ?>
  46. <label>Show button in all single posts</label>
  47. </p>
  48. <p>
  49. <?php
  50. if (get_option('print_button_pages') == 'on') {echo '<input type="checkbox" name="print_button_pages" checked="yes" />';}
  51. else {echo '<input type="checkbox" name="print_button_pages" />';}
  52. ?>
  53. <label>Show button on all pages</label>
  54. </p>
  55.  
  56. <br />
  57. <br />
  58.  
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. <input type="hidden" name="action" value="update" />
  64. <input type="hidden" name="page_options" value="print_button_posts,print_button_pages" />
  65. <div class="submit"><input type="submit" class="button-primary" name="submit" value="Save"></div>
  66.  
  67. </form>
  68. </div>
  69.  
  70. <?php ?>
  71. <?php }
  72.  
  73. }else {
  74.  
  75.  
  76.  
  77. ?>
  78.  
  79. <?php // }
  80.  
  81.  
  82. //add_action('wp_footer', 'fbmlsetup', 100);
  83.  
  84.  
  85. //COMMENT BOX
  86. function printbuttons($content) {
  87.  
  88. if ((is_single() && get_option('print_button_posts') == 'on'))
  89. {
  90. $content .="<a href=".site_url().""."/wp-content/plugins/Printer-Friendly-WP/print.php?id="."". get_the_ID() .""." target="."_blank"." rel='nofollow' class="."print-button"."></a>";
  91.  
  92. return $content;
  93.  
  94. }
  95.  
  96. if ((is_page() && get_option('print_button_pages') == 'on'))
  97. {
  98. $content .="<a href=".site_url().""."/wp-content/plugins/Printer-Friendly-WP/print.php?id=page_id="."". get_the_ID() .""." target="."_blank"." rel='nofollow' class="."print-button"."></a>";
  99.  
  100. return $content;
  101. }
  102.  
  103. return $content;
  104. }
  105. add_filter ('the_content', 'printbuttons', 100);
  106.  
  107. // Add css file
  108. function itg_admin_css_all_page() {
  109.  
  110. wp_register_style($handle = 'printpostpage', $src = plugins_url('css/printpostpage.css', __FILE__), $deps = array(), $ver = '1.0.0', $media = 'all');
  111.  
  112. wp_enqueue_style('printpostpage');
  113. }
  114.  
  115. add_action('wp_head', 'itg_admin_css_all_page');
  116.  
  117. }
  118.  
  119. ?>


Możecie mi pomóc o co im chodzi?

Albo podać mi jakis tutorial dzie jest przykład jakiegoś pluginu który pomoże mi zrobic to prawidłowo?
Tak żeby już przyjeli ten plugin!