• Resolved FuryFC

    (@furyfc)


    I’m new to this. I successfully made a custom post type with this plug-in, and imported a spreadsheet of 23 soccer players, with 32 columns of stats, urls, bio text, etc.

    I’m now trying to display the data and to create a custom post template.

    Only the header and the post_title and post_content seem to be showing. I have a template in a .php file, but must not be calling it correctly.

    I do notice my regular posts now have a custom post template box on the sidebar (although the edit window says no templates are associated). My custom posts have no such option.

    My site is http://www.furyfc.com/blog/

    the custom post type is furyplayers

    the “template” is single-furyplayers.php. It’s code is:

    <?php
    /**
    * The Template for displaying all single furyplayer posts.
    *
    * @package WordPress
    * @subpackage Twenty_Eleven
    * @since Twenty Eleven 1.0
    */

    get_header(); ?>

    <div id=”primary”>
    <div id=”content” role=”main”>

    <?php while ( have_posts() ) : the_post(); ?>

    <nav id=”nav-single”>
    <h3 class=”assistive-text”><?php _e( ‘Post navigation’, ‘twentyeleven’ ); ?></h3>
    <span class=”nav-previous”>
    <?php $back =$_SERVER[‘HTTP_REFERER’];
    if( isset( $back ) && $back != ” ) {
    echo ‘<span class=”meta-nav”>←</span>Return to roster‘;
    }?>–>

    <!–
    <?php previous_post_link( ‘%link’, __( ‘<span class=”meta-nav”>←</span> Previous’, ‘twentyeleven’ ) ); ?></span>

    <span class=”nav-next”><?php next_post_link( ‘%link’, __( ‘Next <span class=”meta-nav”>→</span>’, ‘twentyeleven’ ) ); ?></span>
    –>
    </nav><!– #nav-single –>

    <?php get_template_part( ‘content’, ‘single-furyplayer’ ); ?>

    <?php endwhile; // end of the loop. ?>

    </div><!– #content –>

    </div><!– #primary –>

    <?php get_footer(); ?>

    I also have a file named content-single-furyplayers.php that includes the data get and put commands, as well as a lot of html code and echo statements to populate a 32-field table I’m trying to populate with the data.

    Any help would be appreciated. My concept is similar to this: http://www.youtube.com/watch?v=w9wutxk7zi0 (by the way, I can’t find that plug-in), but with the data going into an html-created table-based format.

    I’m trying to make it look like this:

    http://furyfc.com/blog/wp-content/uploads/2013/09/template_layout.jpg

    I’m excited that, with this plug-in, I was able to import all of my csv for each player to custom posts. Now I just need to show the data.

    I’d settle for showing the data in any format for now, and then worrying about getting the format more refined.

    I suspect my mistake is a typo or something stupid I’m just not recognizing. Unfortunately, since I’m new to this, it’s like I’m working in my non-native language.

    Help please! Anybody!

    http://wordpress.org/plugins/custom-post-type-ui/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    The issue isn’t really our CPT UI plugin, as it registered the post type for you and has done its job. You were able to then import your data and map it to the registered custom post type. The only issue now is querying for that in the database and displaying it. You have the single post view files correct from what i can tell. The naming convention for those is single-{cpt_slug}.php. The other one you’d want for a listing of them, is archive-{cpt_slug}.php

    Sadly, I don’t know where the importing mapped everything. I assume a lot of post meta. So that part is kind of up to you at the moment.

    Thread Starter FuryFC

    (@furyfc)

    You are correct that the data was imported into custom fields (i.e., post meta), so the plug-in works, and I’m very grateful for that.

    To show the data on my page (for my example, I’ll use a custom field named “birthplace”), shouldn’t content-single-furyplayer.php say the following?:

    <?php
    /**
    *This php sends the content to the single-furyplayer template
    *
    *@package WordPress
    *@subpackage Twenty_Eleven
    *@since Twenty Eleven 1.0
    */
    ?>

    <article id=”post-<?php the_ID(); ?>”<?php post_class(); ?>>

    <?php

    echo get_post_meta($post_id, ‘position’, true);
    ?>

    </article>

    That’s what I have, but the resulting post is only showing the post title and the post_content, not the value of the ‘position’ key.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    if the custom field key is “birthplace” then that’s what you’ll want to pass in in place of “position” in your get_post_meta() call. Also, just because I’m not always sure, I’d confirm that $post_id has the right value as well.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Any changes with this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Help With Custom Post Template’ is closed to new replies.