|
K2ChildThemes
Advanced Customization of K2 via Child Themes.
With WordPress 2.7+, it is now possible to override K2's template files by creating a child theme of K2. This allows you to customize K2 without changing the core files. Creating a Child Theme
Customizing K2Refer to K2CSSandCustomCSS on customizing css. Now that you have a blank child theme, you can now start customizing K2. Just make a copy of the template file that you would like to modify into your child theme folder. For example, to customize the Single Post template (single.php), make a copy of single.php into your child theme folder and edit away. Be sure to leave K2's single.php intact. You can also include a functions.php file with your child theme. Refer to the WordPress Plugin API for more info. Note: Please do not modify anything inside the k2/app/ folder. K2 BlocksContent from certain parts of K2 are now stored in the k2/blocks/ folder, and should also be stored in the blocks/ folder in the child-theme's folder.
k2-loop.php is a special case. You can target your customizations to a specific query by making a copy k2-loop.php and naming it:
HooksBelow is a list of hooks provided by K2 and where they appear in the generated HTML source. You can insert content via your child theme's functions.php file or by using the K2 Hook Up plugin. <?php /* K2 Hook - RC6 */ do_action('template_body_top'); ?>
<div id="page">
<?php /* K2 Hook - RC6 */ do_action('template_before_header'); ?>
<div id="header">
Header content is contained in: blocks/k2-header.php
<?php /* K2 Hook - RC6 */ do_action('template_header'); ?>
</div>
<hr />
<?php /* K2 Hook - RC6 */ do_action('template_before_content'); ?>
<div class="content">
<div id="primary-wrapper">
<div id="primary">
<?php /* K2 Hook - RC8 */ do_action('template_content_head'); ?>
<div id="notices"></div>
<div id="current-content" class="hfeed">
<div id="post-#" class="hentry"></div>
</div>
<div id="dynamic-content">
<div id="rollingarchives"></div>
<div id="rollingcontent" class="hfeed">
<div id="post-#" class="hentry">
<div class="entry-head">
<?php /* K2 Hook - RC8 */ do_action('template_entry_head'); ?>
</div>
<div class="entry-content">
</div>
<div class="entry-foot">
<?php /* K2 Hook - RC8 */ do_action('template_entry_foot'); ?>
</div>
</div>
</div>
</div>
<?php /* K2 Hook - RC8 */ do_action('template_content_foot'); ?>
</div> <!-- #primary -->
</div> <!-- #primary-wrapper -->
<hr />
<div id="sidebar-1" class="secondary"></div>
<hr />
<div id="sidebar-2" class="secondary"></div>
<div class="clear"></div>
</div> <!-- .content -->
<?php /* K2 Hook - RC6 */ do_action('template_after_content'); ?>
<div class="clear"></div>
</div> <!-- Close Page -->
<hr />
<?php /* K2 Hook - RC6 */ do_action('template_before_footer'); ?>
<div id="footer">
Footer content is contained in: blocks/k2-footer.php
<?php /* K2 Hook - RC6 */ do_action('template_footer'); ?>
</div>
|