Hooking into the template files

Replies
0
Voices
1
Freshness
Followers

0

Each template – single-discussion-topics.php and archive-discussion-topics.php – has hooks at the start and end of the file. These hooks can be used to replace the opening and closing HTML tags.

The templates are based on the Twenty Fifteen template files so, using the example of the single-discussion-topics.php file, the tags look like:

<div id="primary" class="content-area">
 <main id="main" class="site-main" role="main">

...

 </main>
</div>

These are inserted into the file through hooks. So to insert your own HTML, you just need to override the plugin, e.g.:

remove_action ( 'ctdb_open_wrapper_single', 'ctdb_open_wrapper_single' );
remove_action ( 'ctdb_close_wrapper_single', 'ctdb_close_wrapper_single' );

add_action ( 'ctdb_open_wrapper_single', 'new_open_wrapper_single' );
add_action ( 'ctdb_close_wrapper_single', 'new_close_wrapper_single' );

// Example only
function new_open_wrapper_single() { ?>
 <div id="primary-id" class="my-content-area">
<?php }

// Example only
function new_close_wrapper_single() { ?>
  </div>
<?php }


You’ll need to replace the markup with suitable markup for your theme.

You can repeat this for the archive-discussion-topics.php template:

remove_action ( 'ctdb_open_wrapper_archive', 'ctdb_open_wrapper_archive' );
remove_action ( 'ctdb_close_wrapper_archive', 'ctdb_close_wrapper_archive' );

add_action ( 'ctdb_open_wrapper_archive', 'new_open_wrapper_archive' );
add_action ( 'ctdb_close_wrapper_archive', 'new_close_wrapper_archive' );

// Example only
function new_open_wrapper_archive() { ?>
 <div id="primary-id" class="my-content-area">
<?php }

// Example only
function new_close_wrapper_archive() { ?>
 </div>
<?php }

Double-check your theme files for the correct markup to use.