Grow your CSS skills. Land your dream job.

WordPress Custom Post Type Problemo!

  • # June 12, 2013 at 5:59 am

    Hi there. Could someone check to see if my custom post type has been created properly. This is my first attempt using [a tutorial from wp.tutes](http://wp.tutsplus.com/tutorials/plugins/a-guide-to-wordpress-custom-post-types-creation-display-and-meta-boxes/ “Original Tutorial”)

    This is my custom post type code;

    < ?php
    /*
    Plugin Name: Jobs
    Description: Plugin for Inside Biz Ed
    Version: 1.0
    Author: Alex Johnson
    Author URI: http://webfeetdesign.com/
    */

    add_action( ‘init’, ‘create_job’ );

    function create_job() {
    register_post_type( ‘job_post’,
    array(
    ‘labels’ => array(
    ‘name’ => ‘Job Posts’,
    ‘singular_name’ => ‘Job Post’,
    ‘add_new’ => ‘Add New’,
    ‘add_new_item’ => ‘Add New Job Post’,
    ‘edit’ => ‘Edit’,
    ‘edit_item’ => ‘Edit Job Post’,
    ‘new_item’ => ‘New Job Post’,
    ‘view’ => ‘View’,
    ‘view_item’ => ‘View Job Post’,
    ‘search_items’ => ‘Search Job Posts’,
    ‘not_found’ => ‘No Job Posts found’,
    ‘not_found_in_trash’ => ‘No Job Posts found in Trash’,
    ‘parent’ => ‘Parent Job Post’
    ),

    ‘public’ => true,
    ‘menu_position’ => 15,
    ‘supports’ => array( ‘title’, ‘editor’, ‘thumbnail’ ),
    ‘taxonomies’ => array( ” ),
    ‘menu_icon’ => plugins_url( ‘images/jobs-icon.png’, __FILE__ ),
    ‘has_archive’ => true
    )
    );
    }

    add_action( ‘admin_init’, ‘my_admin’ );

    function my_admin() {
    add_meta_box( ‘job_post_meta_box’,
    ‘Job Post Details’,
    ‘display_job_post_meta_box’,
    ‘job_post’, ‘normal’, ‘high’
    );
    }

    function display_job_post_meta_box( $job ) {
    // Retrieve current name of the employer based on job ID
    $job_employer = esc_html( get_post_meta( $job->ID, ‘job_employer’, true ) );
    // Retrieve current name of the location based on job ID
    $job_location = esc_html( get_post_meta( $job->ID, ‘job_location’, true ) );
    // Retrieve current name of the position based on job ID
    $job_position = esc_html( get_post_meta( $job->ID, ‘job_position’, true ) );
    // Retrieve current name of the salary based on job ID
    $job_salary = esc_html( get_post_meta( $job->ID, ‘job_salary’, true ) );
    // Retrieve current name of the end date based on job ID
    $job_end = esc_html( get_post_meta( $job->ID, ‘job_end’, true ) );
    ?>

    Job Employer Job Location Contract Job Salary Expiry Date http://insidebized.com/jobs/

    I really hope someone can help me here as its dragged on for weeks now.

    Many thanks

    # June 12, 2013 at 8:33 am

    see this page: http://codex.wordpress.org/Template_Hierarchy

    Viewing 2 posts - 1 through 2 (of 2 total)

    You must be logged in to reply to this topic.

    Projects

    Colophon

    CSS-Tricks* is created, written by, and maintained by Chris Coyier. It is built on WordPress, hosted by MediaTemple, and the assets are served by MaxCDN. The fonts are Source Sans and Source Code Pro. It is made possible by viewers like you who subscribe to The Lodge and through advertising for products and services I like.

    *May or may not contain any actual "CSS" or "Tricks".