Add code to StudioPress Genesis Child Theme loop

468 Views Asked by At

I am using the theme Magazine Pro for the Genesis Framework. I have a plugin that in order for it to be displayed I must add the following in the loop.

<?php wptopc($format="select", $prepend="<div class='toc'>", $append=""); ?>
<?php wptopc_pagination_links($prepend="", $append="</div>"); ?>

There is no single.php file or anything like that. I also don't want to change the loop entirely, just add the above code to it. How can I do this for only single_posts?

2

There are 2 best solutions below

0
On BEST ANSWER

So I figured it out. There is a plugin from StudioPress called Genesis Simple Hooks. It allows you to execute shortcode, html and php into various hook elements in the framework.

For my purpose I just added the php code to genesis_before_entry_content

0
On

Another solution is to add a custom function to your child themes functions file with one of the genesis hooks that executes within the loop.

Example:

add_action( 'genesis_before_entry', 'hook_after_header' );

function hook_after_header() {

if ( is_single() ) {

    wptopc($format="select", $prepend="<div class='toc'>", $append="");

    wptopc_pagination_links($prepend="", $append="</div>");
    }
}