For the most part, WP Club Manager templates will integrate nicely with most WordPress themes. Where you may run into problems is when the default WP Club Manager content wrappers do not match your chosen themes. This will manifest itself by breaking your layout on WP Club Manager pages and shifting your sidebars into incorrect positions.
This problem can potentially affect the single player, staff, match and club pages because WP Club Manager uses templates of its own to display these pages and its impossible for WP Club Manager to know exactly what markup your theme uses.
There are two ways to resolve this:
- Using hooks (for advanced users/developers)
- Using our catch-all wpclubmanager_content() function inside your theme
Using wpclubmanager_content()
This solution allows you to create a new template page within your theme that is used for all WP Club Manager post type displays. While an easy catch-all solution, it does have a drawback in that this template is used for all WPCM post types (players, staff, matches and clubs). Developers are encouraged to use the hooks instead.
To set up this template page:
Duplicate page.php
Duplicate your theme’s page.php file, and name it wpclubmanager.php.This file should be found like this: wp-content/themes/YOURTHEME/wpclubmanager.php.
Edit your page (wpclubmanager.php)
Open up your newly created wpclubmanager.php in a text editor, or the editor of your choice.
Replace the loop
Next you need to find the loop (see The_Loop). The loop usually starts with a:
<?php if ( have_posts() ) :
and usually ends with:
<?php endif; ?>
This varies between themes. Once you have found it, delete it. In its place, put:
<?php wpclubmanager_content(); ?>
This will make it use WP Club Manager loop instead. Save the file. You’re done.
Using Hooks
Using hooks to alter the layout of WP Club Manager gives you the flexibility to style your theme in many different ways. This is similar to the method we use when creating our themes. It’s also the method we use to integrate nicely with the default WordPress themes.
By inserting a few lines in your theme’s functions.php
file.
First unhook the WP Club Manager wrappers;
remove_action( 'wpclubmanager_before_main_content', 'wpclubmanager_output_content_wrapper', 10); remove_action( 'wpclubmanager_after_main_content', 'wpclubmanager_output_content_wrapper_end', 10);
Then hook in your own functions to display the wrappers your theme requires;
add_action('wpclubmanager_before_main_content', 'my_theme_wrapper_start', 10); add_action('wpclubmanager_after_main_content', 'my_theme_wrapper_end', 10); function my_theme_wrapper_start() { echo '<section id="main">'; } function my_theme_wrapper_end() { echo '</section>'; }
Make sure that the markup matches that of your theme. If you’re unsure of which classes or ID’s to use take a look at your theme’s page.php for a guide.
Declare WP Club Manager Support
Once you’re happy that your theme fully supports WP Club Manager, you should declare it in the code to hide the “Your theme does not declare WP Club Manager support” message. To do so you should add the following to your theme support function;
add_theme_support( 'wpclubmanager' );
Themes by Clubpress
Save time creating your own templates or finding a suitable theme and get one of our purpose-built WordPress themes. Our themes are built specifically for WP Club Manager and will offer extra functionality and features to make your WordPress club website more comprehensive than ever before.