WordPress.org

Ready to get started?Download WordPress

Forums

How to display custom post type's content in sidebar (4 posts)

  1. coche
    Member
    Posted 11 months ago #

    Hi,
    I would like to add "some" of the custom post type's content in the sidebar. How can I do that?

    I'm thinking in have a "tutorial" custom post type and I wish I can display the main content of the tutorial in the main column, and also use the sidebar to display information about the tutorial, follow-up support, and maybe download source files and that kind of stuff.

    Any help is appreciated.
    Thanks

  2. Daniel
    Member
    Posted 11 months ago #

  3. coche
    Member
    Posted 11 months ago #

    Thanks dannie,
    I checked the article, but I see that is only for displaying custom posts in the sidebar, and not in the main column or body of the page. Also a sidebar widget is more useful for the home page when other posts summaries are displayed... but when you click a post's "continue reading" to see only that post, I would like to use the sidebar for displaying widgets or information that is relevant for that post only.

  4. Daniel
    Member
    Posted 11 months ago #

    coche
    I had same problem today, i tried using some plugins and didnt find the right one. I wanted to display a contact form in a contact page widget only.To save my time i just write a template page for contact page, in which i called a different sidebar like so :
    <?php get_sidebar('contact'); ?>
    Then i went to functions.php file and write this:
    `/***********************************************************************************************/
    /* Add Sidebar Support */
    /***********************************************************************************************/
    if (function_exists('register_sidebar')) {

    register_sidebar(
    array(
    'name' => __('Contact Sidebar', 'the-bootstrap'),
    'id' => 'contact',
    'description' => __('The contact Sidebar', 'the-bootstrap'),
    'before_widget' => '<div class="card" >',
    'after_widget' => '</div> <!-- end footer-widget -->',
    'before_title' => '<h3 class="card-heading simple">',
    'after_title' => '</h3>'
    )
    );
    }`

    After registering that sidebar, it appeared in the widgets area in admin... and i add my contact form easily .. check here http://sdatemeke.adroitplus.com/wasiliana-nasi/

    Hope that helps

Reply

You must log in to post.

About this Topic