- This topic has 10 replies, 2 voices, and was last updated 8 years, 3 months ago by
Tom.
-
AuthorPosts
-
June 27, 2015 at 10:41 am #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=132Plugin author describe some solution here:
https://wpclubmanager.com/docs/themeing/#document-8but I’m not so good with hooks…
so if You got some better solution for me π
thanx a lot
RadekJune 27, 2015 at 12:26 pm #116957Tom
Lead DeveloperLead DeveloperWe 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; }
June 27, 2015 at 12:58 pm #116966Radek
sorry for stupid question, but where can I use this code ? functions.php or some child theme file ?
thanxJune 27, 2015 at 12:59 pm #116968Tom
Lead DeveloperLead DeveloperAny of the options on this page will work: http://generatepress.com/knowledgebase/adding-php-functions/
June 27, 2015 at 1:35 pm #116980Radek
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(); ?>
June 27, 2015 at 1:37 pm #116981Tom
Lead DeveloperLead DeveloperThat would do it.
Try adding this:
add_action('wpclubmanager_sidebar','generate_contruct_sidebars');
June 27, 2015 at 1:41 pm #116983Radek
still the same π
June 27, 2015 at 1:45 pm #116985Radek
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 π
June 28, 2015 at 12:02 am #117034Tom
Lead DeveloperLead DeveloperThis 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? π
June 28, 2015 at 12:45 am #117036Radek
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 πJune 28, 2015 at 10:25 am #117124Tom
Lead DeveloperLead DeveloperWeird – it’s just a 404 page for me.
Either way, glad you found a solution π
-
AuthorPosts
- You must be logged in to reply to this topic.