Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #877013
    PelanPelan
    Participant

    I have spent the last two weeks trying to make this work without making a post to the forums for help. I have scoured the web for the resources and tutorials and nothing has been successful. I have read many threads here in the X support Forum, and followed the various ways to accomplish this and still I have had no such luck. I know what your typical response will be (This is outside the scope of our support.) but I am desperate to get this figured out and you are really my last resort. I am hoping that because I will be supplying you with all the code and steps that despite this falls under custom development you’ll do the best you can to help me get this right. Also if you could considering that because of the way X Theme is structured, it might be the reason I am having such a hard time.

    Important!: Everything I’ve done has been structured through the Ethos X child theme and best practices.

    A brief summary of what I am trying to accomplish:

    A custom post type section on the Admin screen that posts my weekly podcast, “From The Nook”.
    Under the “Add new Episode” post form screen there are several custom fields require filling.
    Those fields output to a single post type similar to the blog on the frontend and also an archive page template.
    The fields consist of the typical structure you’d expect. ie, “Title of Episode”, “Episode Synopsis”, and “Title Episode Segments”, ect, ect.

    STEP ONE:

    I titled and correctly registered my custom post type as a plugin. FOLDER STRUCTURE: PLUGINS/FTN-Podcast/.. Only one php file consists so far: /ftn_podcast.php

    Here is the CPT php code:

    <?php
       /*
       Plugin Name: FTN Podcast
       Plugin URI: http://lonniebruhn.com
       Description: A CPT to seperatly handle the FTN Podcast. 
       Version: 1.0 Beta
       Author: lb
       Author URI: http://lonniebruhn.com
       License: GPL2
       */
    
    function ftn_podcast() {
    
      $labels = array(
        'name'                => _x( 'FTN Episodes', 'Podcast General Name', 'text_domain' ),
        'singular_name'       => _x( 'FTN Episode', 'Course Singular Name', 'text_domain' ),
        'menu_name'           => __( 'FTN Podcast', 'text_domain' ),
        'parent_item_colon'   => __( 'Parent E:', 'text_domain' ),
        'all_items'           => __( 'All Episodes', 'text_domain' ),
        'view_item'           => __( 'View Podcast', 'text_domain' ),
        'add_new_item'        => __( 'Add New Episode', 'text_domain' ),
        'add_new'             => __( 'Add New Episode', 'text_domain' ),
        'edit_item'           => __( 'Edit Episode', 'text_domain' ),
        'update_item'         => __( 'Update Episode', 'text_domain' ),
        'search_items'        => __( 'Search Episode', 'text_domain' ),
        'not_found'           => __( 'Not found', 'text_domain' ),
        'not_found_in_trash'  => __( 'Not found in Trash', 'text_domain' ),
      );
      $args = array(
        'label'               => __( 'Episode', 'text_domain' ),
        'description'         => __( 'Episode Description', 'text_domain' ),
        'labels'              => $labels,
        'supports'            => array( 'title', 'thumbnail' ),
        'taxonomies'          => array( 'category', 'post_tag' ),
        'hierarchical'        => false,
        'public'              => true,
        'show_ui'             => true,
        'show_in_menu'        => true,
        'show_in_nav_menus'   => true,
        'show_in_admin_bar'   => true,
        'menu_position'       => 5,
        'menu_icon'           => 'dashicons-microphone',
        'can_export'          => true,
        'has_archive'         => true,
        'exclude_from_search' => false,
        'publicly_queryable'  => true,
        'rewrite'             => true,
        'capability_type'     => 'post'
      );
      register_post_type( 'ftn_podcast', $args );
    }
    
    add_action( 'init', 'ftn_podcast', 0 );
    ?>

    Note: This works as expected with no issues.

    STEP TWO:

    I used the Advanced Custom Fields plugin to implement the fields I needed for the ftn CPT. On the admin side everything displays correctly and I can add the title, synopsis, and segment titles and hit publish without errors. The post outputs to the permalink:

    It correctly displays the title of the first test episode, “Pot Holes” with a link to the single post. Underneath that it correctly shows the embedded audio player for the episode and plays the audio too. If you follow the title link it follows the structure as normal with the Permalink: http://lonniebruhn.com/ftn_podcast/pot-holes which displays the same exact thing.

    Neither page displays any of the content from the custom fields I filled out on the edit screen and that is after I followed all of the instructional steps the support team provided here for other users having similar problems.

    Note: ACF plugin can either use it’s own custom codex which is almost identical to the codex provided by wordpress codex or it can also use the wordpress codex. I have tried both methods.

    STEP THREE: X CHILD THEME STRUCTURE AND CODE:
    (Directions provided through various other forum support threads)

    I copied over the “single-x-portfolio.php” index file from the parent X theme root folder,and placed it in the root folder of the child theme. I renamed it, “single-ftn_podcast-template.php” and inside customized the code snippet to direct it to the right file, like so:
    <?php x_get_view( x_get_stack(), 'wp', 'single-ftn_podcast-template' ); ?>

    I made a copy of, “single-x-portfolio” which the above snippet references from it’s parent location ../framework/views/ethos and placed it into the x child theme location as it’s parent. I renamed the file, “single-ftn_podcast-template.php” Basically mirroring the same structure.

    After that, I repeated the same process for the archive structure instead using wp-single.php. I placed it in the x child theme following the same path structure as the parent and renamed it: archive-ftn_podcast-template.
    (Note: I worked on the archive template yet because I still can’t display any content on the single-ftn_podcast-template.php.)

    STEP FOUR: INSERTING THE CODE TO DISPLAY THE FIELDS CONTENT:

    Inside the “single-ftn_podcast-template file I’ve customized the loop to try and display just the first field as a test. I am trying to have it display under the title so the customized snippet was placed under ethos, conntent, snippet in the loop. This is had with no success.

    Code example:

    <?php
    
    // =============================================================================
    // VIEWS/ETHOS/CONTENT-PORTFOLIO.PHP
    // -----------------------------------------------------------------------------
    // Portfolio post output for Ethos.
    // =============================================================================
    
    ?>
    
    <?php get_header(); ?>
    
      <div class="x-container max width main">
        <div class="offset cf">
          <div class="x-main full" role="main">
    
            <?php while ( have_posts() ) : the_post(); ?>
              <?php x_get_view( 'ethos', 'content', 'ftn-podcast' ); ?>
                  <p><?php the_field('ftn_epis_content'); ?></p>
              <?php x_get_view( 'global', '_comments-template' ); ?>
            <?php endwhile; ?>
    
          </div>
        </div>
      </div>

    I also tried a few different troubleshooting ideas like following the path that php x_get_view statement references through the various files. This finally led me the to /Global/_content_the-content. I copied over the code in that file, and placed it inside my “single-ftn_podcast-template.php” file. I inserted the,
    `<p><?php the_field(‘ftn_epis_content’); ?></p> into different spots within the code, saving it each time and checking to see if the description content I wrote would display. Still nothing has worked.

    What am I missing? I have tried different display methods described in WP codex, like using the get functions along with echoes. I’ve also tried placing these things inside the loop and outside the loop.

    The problem I am having is that many of the template files you have set up inside your view structure could be using the right snippet I need but I can’t seem to narrow down the right one. This is because each file uses the x_get_view.

    Possible files:
    single.php, wp-single.php, single-x-portfolio.php, wp-single-x-portfolio, content-portfolio.php. and even _content-portfolio.

    If you can give me the guidance than I will understand the steps I’ll need to do correctly display the custom content and then make more customizing pieces just repeating the steps.

    Thanks in advance.

    #877754
    Christian
    Moderator

    Hey there,

    We’re sorry but this is really outside the scope of our support as this requires drastic custom development. You will need to investigate this particular issue on your own or seek help from a developer should you not feel comfortable making these changes yourself.

    Thank you for your understanding.

    #878352
    PelanPelan
    Participant

    Christian,

    Thank you for responding. I have to say that this answer is frustrating to me because I’ve actually read several different threads in this forum where the staff has given assistance in regards to Custom Post types. I have also spent the last two weeks researching the topic, and I watched many tuts on the subject to problem solve the display issue I am having.I did this before making a support request.

    From everything I’ve read, I have done everything correctly. The problem is the way X theme is structured by views. I don’t know what template It has been very difficult to determine what template I am supposed to be editing to correctly display the data. I also disagree that implementing custom post types and fields is a drastic customization. It is fairly easy process with the native WordPress theme.

    I’m not sure if you only briefly read my post but as you can see, I have already done the major part of the work and it is working correctly on the backend. The post type is there, positioned where it is supposed to be, the field form works as it should. The only issue I am having is displaying the data.

    Displaying custom fields should be as easy as putting in one line of code to display the fields:
    <p><?php the_field('ftn_epis_content'); ?></p>

    If X used single.php and index.php in the same way as WP core, I would know exactly what template I am supposed to copy over and edit but since it uses Themco’s own custom templating structure, “views” and each template I go to calls up another template, my issue is narrowing down the correct template that needs to be edited. Therefore, in my opinion, this is within the scope of support since custom post type is a core function in wordpress and with this theme’s structure it makes the process a lot more complicated.

    Even though I have seen other members of the support team help others correct their slightly incorrect code; I can understand if this isn’t something you want to do. At the very least please take the time to tell me which template or templates need customizing. Also, if you could explain how they should be placed inside the child theme.

    As stated above, with the structure of “Views”, setting up CPT’s and trying to choose between these

    possible template files:
    single.php, wp-single.php, single-x-portfolio.php, wp-single-x-portfolio, content-portfolio.php. and even _content-portfolio.

    makes the job that much harder.

    Best Regards
    LB

    #878510
    PelanPelan
    Participant

    Christian,

    Here is the basic structure I know through the different support threads I’ve read here. However, the information and direction has been explained differently in each case. It may have to do with updates to the theme and that over time the structure has changed. A current explanation would really help me.

    X theme uses the index.php as the archive-{custom-post-type}-template.php That information has been consistent within each post. What hasn’t been clear is what template is used for single-{custom-post-type}-template.php. I’ve read that it uses wp-single.php and I’ve read it uses wp-single.portfolio.php which makes sense because Portfolio is a custom post type. I’ve also read it uses content.php and _content.php. Maybe they are all right depending what I am trying to achieve.

    According to the most clear post here, I am to copy over single.php into my child theme root and rename it according to WP CPT naming system. In my case, rename it to single-ftn_custom.php. Then edit the code inside to follow to the right file that would match the file inside my theme’s stack.

    Inside my parent stack path structure copy over wp-single.php and rename it wp-single-ftn_custom.php. Then edit this file inserting the correct code to get it display my single post content.

    I would repeat this process with the index.php to my child theme root and rename it to archive-ftn_podcast-template.php. Then edit it to reference the correct file inside the child theme stack mirroring the parent theme. However, what is not clear is what file in the parent theme do I copy over and used for the archive file template in the stack path? Is it still index .php or is it wp-index.php? If you can clarify this or if this is wrong, and give the correct directions then if I continue to have issues, at least I know that I am coding it wrong and can seek support through other means. Right now, there is too many variables to even debug.

    #878526
    PelanPelan
    Participant

    Edit:

    In my case, rename it to single-ftn_custom.php. Then edit the code inside to follow to the right file that would match the file inside my theme’s stack.

    I didn’t mean to write, “single-ftn_custom.php”. It would be single-ftn_podcast.php.

    #879230
    Christian
    Moderator

    Hey there,

    I’m sorry that you’re frustrated with my response. The View concept is not to make things hard but to make simple and organized a rather complex theme. This is not unique to X only. Editing or making templates in X is the same as regular WordPress themes. If you open single.php in a regular theme for example, you’ll see a lot of code. In X, you’ll only see

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

    x_get_view function will simply point you to a folder within X. x_get_stack function will point you to /framework/views/(stack). wp is then the prefix of the template file wp-single.php. wp-single.php file also links other templates using the x_get_view function. With that said, if you need to create a single file for a custom post type for example, you will simply need to create the needed templates for it now that you understand how templating in X works.

    http://i.imgur.com/B91S7jq.gifv

    This should be understood by a web developer and we expect that if you work on these files that you know how to edit or copy or at least have a good understanding of them. If you’re not comfortable with working on them or have a tight deadline, I recommend you seek help from a web developer to work closely on your project.

    Please don’t get me wrong. We love to help each and every person beyond the scope of support but we have to draw a line somewhere.

    Thank you for understanding.

    #880857
    PelanPelan
    Participant

    Thank you. Yes, I do understand and I feel I have a good understanding of the concept and I’m never uncomfortable working with code. In fact, I’d say I prefer it. If there is a way to accomplish it in code, I’d do that over a plugin.

    To clarify my frustration, it’s because I’ve read threads on this topic that had code examples and if there was something coded wrong the team has helped correct it. I thought I provided enough information that if you saw something or a missed step you could assist me. And the Theme support here is outstanding and I do understand that not everything can get an answer to fix the issue.

    Final question:
    So if I understand correctly, the two files I need to be working with to make my template is a copy of single.php in the root of the child theme and wp-single.php in the root stack of the child theme following the same structure as the parent theme. Both renamed to what I need and aside from the php, I’d use the x_get_view and x_get_stack functions and if my template is called ftn_podcast-template I would replace that inside the string and also remove the prefix?

    #880874
    PelanPelan
    Participant

    Sorry, I meant if my template is called, single-ftn_podcast.php

    #881497
    Christian
    Moderator

    Yes, that is correct.

    #884981
    PelanPelan
    Participant

    Thank you. I still haven’t figure out why it isn’t even displaying even any test text on the frontend but I do understand the way the theme references the templates. I may have another question on this topic but I’ll make sure that it has to do with the theme within the scope of the support you can provide.
    LB

    #886207
    Christian
    Moderator

    You’re welcome, LB. 🙂

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