Support » Fixing WordPress » Building a Plugin From Scratch

  • So I’m just getting into plugin development and I figured for my first very first plugin, I would make something super simple and useful. What I’m trying to accomplish is a plugin that adds a metabox to the “edit post” page in the admin panel that allows users to add some simple meta tags – description, keywords, etc.

    I’m really good at php, but this is my first time trying to build a plugin, let alone one that adds metaboxes for meta tags lol

    A little guidance would be greatly appreciated! 🙂

Viewing 10 replies - 1 through 10 (of 10 total)
  • Hello, you could find guide here as said by WP Yogi – I’m also starting to write a plugin for Gmail Login blog, if you get some more resources, also share with me.

    @jafardhada – please be aware that using these forums to post unnecessary links to your site is not permitted. They will be deleted.

    Might also want to review using ‘gmail’ in a url as it’s a trademark of a rather large multibillion dollar corporation that has a very large legal dept. 🙂

    Edit: Mod removed link…

    Excellent point – in fact it’s right on this page:

    I’ve checked out the writing a plugin page, but what I’m hoping to find is a simple plugin example that has somewhat similar functionality that I can toy around with. I’ve already created this functionality when I learned how to use custom fields, but I would like a more user friendly way to enter the data and not have it limited to the theme. I’m thinking that once I learn how to create meta-boxes with a plugin, that would open the door for me to be able to create a whole slew of useful plugins.

    Which leads me to my next question lol is it possible to use meta-boxes to fill in data for custom fields? I’m almost positive this is plausible but just want to make sure lol

    this is what I have so far lol

    Plugin Name: custom meta box
    Plugin URI:
    Description: This plugin adds a custom meta box to the post page on the admin panel that allows user to enter post related data.
    Version: Beta
    Author: Russ Powers
    Author URI:
        add_action( 'add_meta_boxes', 'cd_meta_box_add' );
        function cd_meta_box_add() {
            add_meta_box( 'my-meta-box-id', 'My First Meta Box', 'cd_meta_box_cb', 'post', 'normal', 'high' );
        function cd_meta_box_cb( $post ) {
    		$values = get_post_custom( $post->ID );
    		$text = isset( $values['my_meta_box_text'] ) ? esc_attr( $values['my_meta_box_text'][0] ) : ”;
    		$selected = isset( $values['my_meta_box_select'] ) ? esc_attr( $values['my_meta_box_select'][0] ) : ”;
    		$check = isset( $values['my_meta_box_check'] ) ? esc_attr( $values['my_meta_box_check'][0] ) : ”;
    			<label for="my_meta_box_text">Text Label</label>
    			<input type="text" name="my_meta_box_text" id="my_meta_box_text" value="<?php echo $text; ?>" />

    Have you looked at these?

    (Sorry for the diversion above, BTW.)

    No worries, I completely understand the diversion 🙂 I made sure to replace my URL’s with in the code snippet above lol I was able to get the code above to work for a split second, generated the metabox and everything – but I had some code showing up at the top of all the pages in the admin panel.

    I’ve checked out a few of the pre-existing meta-box plugins but some of them are a little to complicated for me to find the very basic functions and syntax required. I’ve been looking for a plugin that adds a single meta-box for something silly like current mood or current song but haven’t found anything useful lol

    How about the Codex –

    I’m really not the one to help with code questions and you will likely get better help on the Hacks forum for something like this.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Building a Plugin From Scratch’ is closed to new replies.