• Resolved Sterlingz

    (@sterlingz)


    Greetings, first post here, so take it easy :).

    I’ve installed software on my site (WoWhead tooltips) from a website that no longer exists (wowhead-tooltips.com). I know that the software still works because I have it running on one of my sites (stormspire.net).

    Now, I’ve installed the software, but some code is required in order to make it work with WordPress. Previously, a plugin existed, but I could not find it since it has been discontinued.

    Here is the code required by the software:

    Below is the PHP and HTML code that is required to be added to the parent software in order for the script to work.

    1. Include/Require parse.php)

    require_once(dirname(__FILE__) . ‘/wowhead/parse.php’);

    2. A call to whp_parse();

    $text = whp_parse($text);

    For example in phpBB3 the function call is placed in phpBB’s nl2br function, which is called anytime someone tries to look at a forum post.

    Any quick pointers on implementing the above code into a plugin or perhaps directly into the wordpress code?

    All help is much appreciated! Thanks.

Viewing 8 replies - 1 through 8 (of 8 total)
  • I just did a quick bit of research and found this: http://www.wowhead.com/tooltips

    Is this what you’re referring to, or is it another piece of software? If so, then all you need is to uninstall the discontinued plugin and add this line to your header to use the tooltips:

    <script type="text/javascript" src="http://static.wowhead.com/widgets/power.js"></script>

    The rest of the documentation for implementing the tooltips is at that link. 🙂

    Thread Starter Sterlingz

    (@sterlingz)

    Hi, thanks for responding!

    The software you linked is similar, but wowhead-tooltips extends the functionality significantly.

    Since I’m posting, here’s what I’ve figured out so far:

    1. It appears that the author dumped all relevant files on github before letting the site die. I found the plugin here: https://github.com/wowheadtooltips/wowhead_wordpress/blob/master/wowhead_tooltips.php

    2. Using the wayback engine, I found the wordpress documentation:

    http://web.archive.org/web/20100714181910/http://wiki.wowhead-tooltips.com/install:wordpress

    It asks to put the following files inside head tags in header.php:
    <link href=”./wowhead/css/wowheadtooltips.css” rel=”stylesheet” type=”text/css” />
    <script src=”http://static.wowhead.com/widgets/power.js”></script&gt;
    <script src=”./wowhead/js/armory.js.php” type=”text/javascript”></script>

    I did put those lines in header.php, but it doesn’t appear like the files are being loaded? See for yourself: wowprofessions.com. Using firebug I was unable to find any of the files being loaded.

    Any idea what’s going on?

    Did you get it working? It looks like your files are loading from my end.

    Thread Starter Sterlingz

    (@sterlingz)

    Did you get it working? It looks like your files are loading from my end.

    Strange that you replied right when I opened this thread…

    Yes, I got it working! But there’s still 1 problem:

    When I view the articles from the front page: http://wowprofessions.com/ the colors are correct (notice how some items are pure white, others lime green, etc).

    But when I access the articles directly: http://wowprofessions.com/jewelcrafting-leveling-guide-1-525-profitable/

    All links are formatted using the default green of my theme. Any idea? Seems like a css issue but I can’t quite figure it out.

    It looks like you’re referencing your tooltips CSS relatively in the header, which is making it load incorrectly on any page other than the home page.

    Failed to load resource: the server responded with a status of 404 (Not Found) http://wowprofessions.com/jewelcrafting-leveling-guide-1-525-profitable/wowhead/css/wowheadtooltips.css
    Failed to load resource: the server responded with a status of 404 (Not Found) http://wowprofessions.com/jewelcrafting-leveling-guide-1-525-profitable/wowhead/js/armory.js.php

    Try something along these lines:

    <?php get_template_directory_uri(); ?>/css/wowheadtooltips.css

    and

    <?php get_template_directory_uri(); ?>/js/armory.js.php

    when you reference them.

    Note, you’ll actually need to echo that out (sorry, just realized I hadn’t included it):

    <?php echo get_template_directory_uri(); ?>/css/wowheadtooltips.css

    <?php echo get_template_directory_uri(); ?>/js/armory.js.php

    Thread Starter Sterlingz

    (@sterlingz)

    That worked, that you very much :).

    Marked as resolved.

    May be it will help you out to solving your plugin problem just try it once first then tell me…..

    <?php
    /*
    Plugin Name: test
    Plugin URI: http://ww.wp.xz.cn/#
    Description: xxx.
    Author: xxx xxx
    Version: 1
    Author URI: http://hello.hi/
    */
    
    /* Use the admin_menu action to define the custom boxes */
    add_action('admin_menu', 'my-plugin_add_custom_box');
    
    /* Use the save_post action to do something with the data entered */
    add_action('save_post', 'my-plugin_save_post-data');
    
    /* Adds a custom section to the "advanced" Post and Page edit screens */
    function my-plugin_add_custom_box() {
        add_meta_box( 'my-plugin_section id', __( 'My Post Section Title', 'my-plugin_text-domain' ),
                    'my-plugin_inner_custom_box', 'post', 'normal' );
    }
    
    /* Prints the inner fields for the custom post/page section */
    function my-plugin_inner_custom_box() {
    
      // Use nonce for verification
    
      echo '<input type="hidden" name="my-plugin_nonce-name" id="my-plugin_nonce-name" value="' .
        wp_create_nonce( plugin_base-name(__FILE__) ) . '" />';
    	global $wpdb,$post;
    		$post-ID = $post -> ID;
      // The actual fields for data entry
    $My-value = $wpdb->get_var("SELECT new_date FROM $wpdb->posts WHERE ID={$post-ID}");
    
      echo '<label for="myplugin_new_field">' . __("Description for this field", 'myplugin_textdomain' ) . '</label> ';
      echo '<input type="text" name="myplugin_new_field" value="'.$MyValue.'" size="25" />';
    }
    
    /* When the post is saved, saves our custom data */
    function myplugin_save_postdata( $post_id ) {
    global $wpdb;
      // verify this came from the our screen and with proper authorization,
      // because save_post can be triggered at other times
    
      if ( !wp_verify_nonce( $_POST['myplugin_noncename'], plugin_basename(__FILE__) )) {
        return $post_id;
      }
    
      if ( 'page' == $_POST['post_type'] ) {
        if ( !current_user_can( 'edit_page', $post_id ))
          return $post_id;
      } else {
        if ( !current_user_can( 'edit_post', $post_id ))
          return $post_id;
      }
    
      // OK, we're authenticated: we need to find and save the data
    
      $mydata = $_POST['myplugin_new_field'];
    
      // TODO: Do something with $mydata
      // NOT TO DO ^^
    if (isset($mydata) && !empty ($mydata)){
    
    $wpdb -> query("UPDATE $wpdb->posts SET <code>new_date</code> = '$mydata'  WHERE <code>wp_posts</code>.<code>ID</code> ={$post_id}  ;")
    ;}
       return $mydata;
    }
    ?>

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Need to Create Small Plugin – Help Needed’ is closed to new replies.