Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #857653

    guy_b
    Participant

    Hi,

    I almost afraid to ask this question because I feel I will be told that you don’t offer customization advice, hire a developer..

    I’m feeling very discouraged with trying to make this theme work the way I want right now.

    It seems like such a basic request though, and it is easy with less complex themes.

    All I would like, is to have the widgets in a custom sidebar show up on my single custom post type posts.

    I have read all the posts I can find about this, and can’t seem to make it work.

    Is there a proper tutorial somewhere?

    I have a child theme activated, and have created a custom post type.

    Using Integrity.

    As much as I would like to, I can’t provide a url or login details.

    The site is a development site, and I cannot make changes to the live site until I have fixed it in dev.

    Which template files do I need to copy to the child folder and how do I add the sidebars to the single custom post types?

    Once I have copied the correct files, what do I need to do make it work?

    I would really appreciate some help here.

    #858111

    Rupok
    Member

    Hi there,

    Thanks for writing in! You can follow this thread – https://community.theme.co/forums/topic/custom-post-type-layout/

    Hope this helps.

    Cheers!

    #858980

    guy_b
    Participant

    Hi, thanks.. that sort of helped…

    I can get the sidebars showing on my single posts, but what I would like to do is replace the loop query for the standard posts with the custom post type singles.

    I have created a custom “View”, but can’t seem to get it to display:

    <?php
    
    // =============================================================================
    // VIEWS/INTEGRITY/WP-SINGLE-NEWS-ARTICLE.PHP
    // -----------------------------------------------------------------------------
    // Single Article output for Integrity.
    // =============================================================================
    
    ?>
    
    <?php get_header(); ?>
    
      <div class="x-container max width offset">
        <div class="x-main right" role="main">
    
          <?php while ( have_posts() ) : the_post(); ?>
            <?php x_get_view( 'integrity', 'content', get_post_format() ); ?>
            <?php x_get_view( 'global', '_comments-template' ); ?>
          <?php endwhile; ?>
    
        </div>
    
         <aside class="<?php x_sidebar_class(); ?>" role="complementary">
          <?php if ( get_option( 'ups_sidebars' ) != array() ) : ?>
            <?php dynamic_sidebar( apply_filters( 'ups_sidebar', 'latest-news' ) ); ?>
          <?php else : ?>
            <?php dynamic_sidebar( 'latest-news' ); ?>
          <?php endif; ?>
        </aside>
    
      </div>
    
    <?php get_footer(); ?>

    Clearly I need to replace something somewhere to make my custom post display, and I’m guessing it must be something pretty simple?

    What am I missing?

    Which View template do I need to copy into the Child’s Global and Stack view to replace the wp-single output on the front end?

    #859869

    Rad
    Moderator

    Hi there,

    You don’t need to re-create the custom query, WordPress will automatically do that for your custom post type. What you could be missing is custom post type template,

    Please create this file,

    /wp-content/themes/x/single-news-article.php

    with this code,

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

    Hope this helps.

    #860714

    guy_b
    Participant

    Yes, that helps!

    Getting somewhere now…

    Thanks 🙂

    #861282

    Jade
    Moderator

    You’re welcome Guy.