Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: P2 Theme


peterverkooijen
Participant

@peterverkooijen

I’m trying to integrate the P2 theme into my custom theme. I only want all the required P2 files loaded with the home.php, the javascript in particular because it tries to ajaxify all edit links and is causing problems with some other jquery.

I tried modifying this:

function init() {
if ( !is_admin() ) {
add_action( 'wp_print_scripts', array('P2JS', 'enqueue_scripts') );
}
add_action('wp_head', array('P2JS', 'print_options'));
}

…to only load in the header.php only when the page is_home, like this:

if (is_home() )
{
p2_head();
}

That sorta worked, but most of the other crap in P2’s js.php still gets loaded.

I tried put if (is_home() ) around the js.php, but that didn’t work at all.

How do I make lines like these conditional – if that’s the right term…?:

wp_enqueue_script( 'p2js', P2_JS_URL . '/p2.js', array( 'jquery', 'utils' ), filemtime(P2_JS_PATH . '/p2.js') );

Or is there a better way to limit all the P2 code to the home.php? I had to just merge the P2 functions.php with my theme’s functions.php, because I couldn’t figure out how to make them load with a custom p2_functions.php files.

Skip to toolbar