Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1280205
    2342J
    Participant

    I have created a set of custom post types using CPT UI. Which works. For example I have “route” and “country.”

    To create a template for “route” posts I duplicated the following files into my child theme in the same directory:

    1) single.php becomes single-route.php

    2) In single-route.php I updated the code from:

    
    <?php x_get_view( x_get_stack(), 'wp', 'single' ); ?>

    to this:

    
    <?php x_get_view( x_get_stack(), 'wp', 'single-route' ); ?>

    3) content.php becomes content-route.php

    4) I updated the following code in content-route.php from:

    
    <?php x_get_view( 'ethos', '_content', 'post-header' ); ?>

    to this:

    
    <?php x_get_view( 'ethos', '_content', 'route', 'post-header' ); ?>

    4) wp-single.php becomes wp-single-route.php

    All of that worked, my new template applied to the “route” custom post type.

    Now, when I repeated that process substituting “country” in place of route it does not work for me. The country posts return a 500 error.

    Is there something I am missing?

    Thanks for the help.

    #1280311
    Rue Nel
    Moderator

    Hello There,

    Thanks for writing in! Error 500 usually means a fatal error. Can you please enable WP_DEBUG mode? You can do this by opening wp-config.php and adding
    define( 'WP_DEBUG' , true ); just above /* That's all, stop editing! Happy blogging. */ For example:

    define('WP_DEBUG', true);
    
    /* That's all, stop editing! Happy blogging. */

    When you revisit the page with the error 500, you should have some error output describing the issue in more detail.

    Please let us know how it goes.

    #1280515
    2342J
    Participant

    Ok, so I’m on IIS but I was able to pull the PHP error log:

    [04-Dec-2016 15:23:17 UTC] PHP Parse error:  syntax error, unexpected ''single-country’ ); ?>
    ' (T_ENCAPSED_AND_WHITESPACE) in D:\home\site\wwwroot\wp-content\themes\x-child\single-country.php on line 17

    This is my line 17 (the very end):

    <?php
    
    // =============================================================================
    // SINGLE-COUNTRY.PHP
    // -----------------------------------------------------------------------------
    // Handles output of individual countries. LANDON
    //
    // Content is output based on which Stack has been selected in the Customizer.
    // To view and/or edit the markup of your Stack's posts, first go to "views"
    // inside the "framework" subdirectory. Once inside, find your Stack's folder
    // and look for a file called "wp-single-country.php," where you'll be able to find the
    // appropriate output.
    // =============================================================================
    
    ?>
    
    <?php x_get_view( x_get_stack(), 'wp', 'single-country’ ); ?>

    Honestly I’m stuck. Everything looks right to me.

    #1280524
    Thai
    Moderator

    Please replace your code with this:

    <?php x_get_view( x_get_stack(), 'wp', 'single-country' ); ?>

    Hope it helps 🙂

    #1280530
    2342J
    Participant

    That worked. I don’t understand, to my eye that’s identical. What’s the difference here?

    #1280550
    Thai
    Moderator

    Hi There,

    The different is vs '.

    Cheers!

    #1297307
    2342J
    Participant

    Resolved. Thank you so much.

    #1297456
    Rue Nel
    Moderator

    You are most welcome!

  • <script> jQuery(function($){ $("#no-reply-1280205 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>