How to Embed IRC to WordPress

Internet Relay Chat (IRC) is a chatting system that works over the Internet. Users of IRC typically log on to an IRC server through a stand-alone chat client that does not run inside a browser. Some Flash-based IRC clients are available for pasting into websites. In WordPress, you can embed IRC in to a custom page template and create a page that is set to use that template. This will add a chat page to your blog.

Instructions

    • 1

      Go to the folder containing your theme on your computer. Open the “page.php” template in Notepad or a code editor. Copy and paste its code into a blank file and save it as “chat.php.”

    • 2

      Add this line of code at the top of your “chat.php” file:

      <?php // Template Name: Chat Page ?>

      This must be on the first line of the file, with nothing above it. WordPress will read this comment line and know to include the template as a custom page template.

    • 3

      Find this line in your “chat.php” file:

      <?php the_content(); ?>

      This code is what outputs the text you enter in the page editor box within WordPress. Leave this in the file so you can add text above the chat, introducing users and setting a few, simple ground rules.

    • 4

      Copy this code and paste it below the content output:

      <iframe src="http://lightirc.com/start/?host=irc.lightirc.com&autojoin=%23test&showNickSelection=true&nick=User_%25" style="width:800px; height:400px;"></iframe>

      This code will embed lightIRC in your custom template. You can test your template with the code as-is, but it will only take users to a test IRC channel.

    • 5

      Change “irc.lightirc.com” to the server name for your IRC chat. For example, if you use an IRC server named “irc.coolchatz.com” use that instead of the default already in the code.

    • 6

      Find the word “test” inside the lightIRC code and change it to the name of your chat. If your chat is “#wpchat,” then replace “test” with “wpchat.” The “%23” inside the code represents the hash symbol, so you do not need to add that.

    • 7

      Change the width and height of the chat box by editing their values in the “style” attribute of the “<iframe>” code:

      style=”width:800px; height:400px;”

      The default width of 800 pixels is likely too wide for most WordPress layouts. Change it to fit in your theme's content column. If you are unsure of the width you need, use a percentage:

      style=”width:80%px; height: 400px;”

    • 8

      Save your template and upload it to the following location on your server:

      /wp-content/themes/theme-name/

      You can use either an FTP client or your web host's file management tool to upload this file.

    • 9

      Log in to WordPress and go to Pages from the sidebar. Add a new page and select “Chat Page” from the “Templates” drop-down. Add any introductory text for the chat in the editor box and publish the page. When you load the page in the browser, it will ask you to enter a username and then will log you in to the chat, so long as you edited the code with correct information.

Tips & Warnings

  • You can also embed chats in your posts, but by default the post editor strips out “<iframe>” tags. To get around this, install a plug-in that adds iFrame capability to pots.

  • Before embedding an IRC client in to your WordPress blog, you must first set up an IRC channel. Download a stand-alone IRC client to get started.

Related Searches:

References

Resources

Comments

Related Ads

Featured