[Resolved] Sidebar layout not work

Home Forums Support [Resolved] Sidebar layout not work

Home Forums Support Sidebar layout not work

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #116944
    Radek

    Hi Tom, any way how to get GP sidebar layout + footer widget work with custom post types ?
    For understanding if I choose “Content without sidebars” there is still sidebar at post frontend, but under content as You can see: http://test.erenza.net/?post_type=wpcm_match&p=132

    Plugin author describe some solution here:
    https://wpclubmanager.com/docs/themeing/#document-8

    but I’m not so good with hooks…

    so if You got some better solution for me πŸ˜‰

    thanx a lot
    Radek

    #116957
    Tom
    Lead Developer
    Lead Developer

    We have a pretty awesome filter that allows you to set the sidebar layout for custom areas: generatepress.com/knowledgebase/choosing-sidebar-layouts/#sidebar-filter

    In this case, you could do something like this:

    add_filter( 'generate_sidebar_layout','generate_custom_post_type_sidebar_layout' );
    function generate_custom_post_type_sidebar_layout( $layout )
    {
     	// Set the sidebar
     	if ( 'wpcm_match' == get_post_type() )
     	 	return 'left-sidebar';
    
     	// Or else, set the regular layout
     	return $layout;
    
    }
    #116966
    Radek

    sorry for stupid question, but where can I use this code ? functions.php or some child theme file ?
    thanx

    #116968
    Tom
    Lead Developer
    Lead Developer

    Any of the options on this page will work: http://generatepress.com/knowledgebase/adding-php-functions/

    #116980
    Radek

    doesnt work (child theme functions.php method).
    maybe because there is this file: wp-club-manager/templates/single-match.php with this code:

    <?php
    /**
     * The Template for displaying all single matches.
     *
     * Override this template by copying it to yourtheme/wpclubmanager/single-match.php
     *
     * @author 		ClubPress
     * @package 	WPClubManager/Templates
     * @version     1.0.0
     */
    
    if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    
    get_header(); ?>
    
    	<?php
    		/**
    		 * wpclubmanager_before_main_content hook
    		 *
    		 * @hooked wpclubmanager_output_content_wrapper - 10 (outputs opening divs for the content)
    		 * @hooked wpclubmanager_breadcrumb - 20
    		 */
    		do_action('wpclubmanager_before_main_content');
    	?>
    
    		<?php while ( have_posts() ) : the_post(); ?>
    
    			<?php wpclubmanager_get_template_part( 'content', 'single-match' ); ?>
    
    		<?php endwhile; // end of the loop. ?>
    
    	<?php
    		/**
    		 * wpclubmanager_after_main_content hook
    		 *
    		 * @hooked wpclubmanager_output_content_wrapper_end - 10 (outputs closing divs for the content)
    		 */
    		do_action('wpclubmanager_after_main_content');
    	?>
    
    	<?php
    		/**
    		 * wpclubmanager_sidebar hook
    		 *
    		 * @hooked wpclubmanager_get_sidebar - 10
    		 */
    		do_action('wpclubmanager_sidebar');
    	?>
     
    <?php get_footer(); ?>
    #116981
    Tom
    Lead Developer
    Lead Developer

    That would do it.

    Try adding this:

    add_action('wpclubmanager_sidebar','generate_contruct_sidebars');

    #116983
    Radek

    still the same πŸ™

    #116985
    Radek

    if I commented:

    <?php
    		/**
    		 * wpclubmanager_sidebar hook
    		 *
    		 * @hooked wpclubmanager_get_sidebar - 10
    		 *
    		* do_action('wpclubmanager_sidebar');
    		*/
    	?>

    sidebar is gone, but thats not clean solution for me πŸ™‚

    #117034
    Tom
    Lead Developer
    Lead Developer

    This URL doesn’t seem to be working for me: http://test.erenza.net/?post_type=wpcm_match&p=132

    Can you double-check it and let me know? πŸ™‚

    #117036
    Radek

    it works for me, but its already OK because I did workaround using page template from GP to plugin file single-match.php
    Yes, not comfortable solution, but if Im not good with programming, filters and hooks πŸ˜‰

    #117124
    Tom
    Lead Developer
    Lead Developer

    Weird – it’s just a 404 page for me.

    Either way, glad you found a solution πŸ™‚

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.