Remove sidebars by default

This topic contains 13 replies, has 3 voices, and was last updated by  Olivier 7 months, 3 weeks ago.

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #9641

    Juanma Aranda
    Participant
    • 8 Posts
    @wpnovatos

    Hello!
    I have created a CPT called “podcast” and the theme assigns by default a template with two sidebars (left and right) to both the cpt file page and the individual cpt page.
    I need this CPT to show the same template as for normal posts.
    How can I do it? Thanks in advance.

    #9658

    Jean-Pascal
    Moderator
    • 615 Posts
    @themopteryx
    Themosaurus Support

    Hi @wpnovatos,

    Thank you for bringing this to our attention.
    We will investigate further to find how to improve this.

    We will be back to you ASAP.

    Thank you for your patience.

    Regards,

    #9685

    Juanma Aranda
    Participant
    • 8 Posts
    @wpnovatos

    It really is something very strange.
    The CPTs that I created after installing your theme do not respect the page template attribute when forced.
    Check what happens when you enter https://wpnovatos.com/podcast/episodio134/
    Keep holding a right sidebar and push it off the screen until it is placed under the content.

    All CPTs that were created before installing your theme, allow you to choose a page template, although the elements such as title, featured image, etc., are not displayed in the same place as the post template, which should be correct.

    #9686

    Juanma Aranda
    Participant
    • 8 Posts
    @wpnovatos

    I have just discovered that the bar pushes it when you insert an image of a certain width into the content. Instead of adapting the image to the set width of the content box and displaying it in proportional size, push the bar out and modify the width of the content.

    If I remove the image, the right sidebar reappears in its position, but still, the CPT does not assume the structure of the posts, despite having cloned in single.php and renamed it to single-podcast.php

    #9690

    Olivier
    Moderator
    • 1799 Posts
    @themosaurusrex
    Themosaurus Support

    Hi @wpnovatos,

    We’re sorry for the trouble you’ve been experiencing with this issue.

    Our theme and Grimlock are adding an extra layer to the standard WP template hierarchy to allow users to Customize their post archive and single post templates.

    Few PHP code lines might be required to make the single podcast fit the single post template. Do you wish to achieve the following layout? (Please see attached.)

    I want to be sure that I understand what you want to achieve. Could you provide us with screenshots of your website please? Please don’t hesitate to comment or highlight your screenshots to help us better understand your issue.

    Thank you.

    #9698

    Juanma Aranda
    Participant
    • 8 Posts
    @wpnovatos

    Hi Olivier!
    Thank you for responding quickly.

    In summary, what I need is that the appearance of the individual entries of the CPT “podcast” be treated in the same way as the individual posts, which have the same appearance.

    And at the same time, that the archive page of the CPT “podcast” looks the same as the archive page of the posts (blog) instead of what is now displayed.

    I leave you some screenshots so you can see the differences that exist today.

    #9719

    Olivier
    Moderator
    • 1799 Posts
    @themosaurusrex
    Themosaurus Support

    Hi @wpnovatos,

    Let’s set the single podcast first. To improve its display, simply add the following code snippet to your website:

    /**
     * Apply post settings to single podcasts.
     */
    function gwangi_custom_is_template( $is_template ) {
    	return $is_template || is_singular( 'podcast' );
    }
    add_filter( 'grimlock_single_customizer_is_template', 'gwangi_custom_is_template', 1000, 1 );
    
    /**
     * Add post styling to single podcasts.
     */
    function gwangi_custom_add_body_classes( $classes ) {
    	if ( is_singular( 'podcast' ) ) {
    		$classes [] = 'single-post';
    	}
    	return $classes;
    }
    add_filter( 'body_class', 'gwangi_custom_add_body_classes', 1000, 1 );

    To add this code snippet to your site, we recommend that you use a the Code Snippets plugin (https://wordpress.org/plugins/code-snippets/). If you have never activated this plugin, please read the following post:

    Adding Custom PHP Without Changing Your Child Theme

    Please also note that we don’t provide any theme customization. So, you shouldn’t expect other snippets from us unless it’s to fix an issue stemming from our own codebase. We always try our best to help theme users whenever we can and only provide code snippets out of courtesy to prevent them from waiting for the next update.

    Regards,

    #9720

    Olivier
    Moderator
    • 1799 Posts
    @themosaurusrex
    Themosaurus Support

    Once done, could share a screenshot of your single podcasts please?
    Thank you.

    #9723

    Juanma Aranda
    Participant
    • 8 Posts
    @wpnovatos

    Thanks Olivier!
    That really worked.
    Now single podcasts look the same as post single.
    That’s great

    #9737

    Olivier
    Moderator
    • 1799 Posts
    @themosaurusrex
    Themosaurus Support

    Hi @wpnovatos,

    Good news! Do we need to improve your podcast archive now or do you wish to keep a different layout from the blog? And what exactly needs to change? I see a blank header for instance. Do you wish to add the archive title to the header?

    Thank you.

    #9738

    Juanma Aranda
    Participant
    • 8 Posts
    @wpnovatos

    Hi Olivier!
    I need the CPT archive page to display the same as the blog posts, with the title “Podcast” and the same grid style. Thank you so much for all your help.

    #9762

    Olivier
    Moderator
    • 1799 Posts
    @themosaurusrex
    Themosaurus Support

    OK, understood. Would please replace the previous code snippet with following please?

    /**
     * Apply post settings to single podcasts.
     */
    function gwangi_custom_is_template( $is_template ) {
    	return $is_template || is_singular( 'podcast' );
    }
    add_filter( 'grimlock_single_customizer_is_template', 'gwangi_custom_is_template', 1000, 1 );
    
    /**
     * Apply post settings to single podcasts.
     */
    function gwangi_custom_is_archive_template( $is_template ) {
    	return $is_template || is_post_type_archive( 'podcast' );
    }
    add_filter( 'grimlock_archive_customizer_is_template', 'gwangi_custom_is_archive_template', 1000, 1 );
    
    /**
     * Add podcast archive title to podcast archive.
     */
    function gwangi_custom_add_custom_header_args( $args ) {
    	if ( is_post_type_archive( 'podcast' ) ) {
    		$args['title']    = get_the_archive_title();
    		$args['subtitle'] = get_the_archive_description();
    	}
    	return $args;
    }
    add_filter( 'grimlock_custom_header_args', 'gwangi_custom_add_custom_header_args', 1000, 1 );
    
    /**
     * Add post styling to single podcasts.
     */
    function gwangi_custom_add_body_classes( $classes ) {
    	if ( is_singular( 'podcast' ) ) {
    		$classes [] = 'single-post';
    	}
    	return $classes;
    }
    add_filter( 'body_class', 'gwangi_custom_add_body_classes', 1000, 1 );

    It should give you the desired layout. (Please see attached.)

    Cheers,

    #9764

    Juanma Aranda
    Participant
    • 8 Posts
    @wpnovatos

    Hi Olivier!

    Thank you for all of your help. Now it looks great on my site.

    As a suggestion for an upcoming theme update, there should be an option in the customizer to choose a layout for the CPTs and their archive pages.

    Greetings!

    #9788

    Olivier
    Moderator
    • 1799 Posts
    @themosaurusrex
    Themosaurus Support

    Hi @wpnovatos,

    Thank you for the great feedback! 🙂
    We’ll think about it and find the best way to implement this feature.

    Cheers,

Viewing 14 posts - 1 through 14 (of 14 total)

The topic ‘Remove sidebars by default’ is closed to new replies.