Jump to content
jamesldesign

Custom Templates & Hooks?

Recommended Posts

jamesldesign

Hi,

I'm not sure if I'm missing something but can I add code via hooks in template files the same way I do via the functions file?

 

For instance, I only want the dummy text "Foo!" to appear when a page is using the "Chapter Houston" template

<?php
/*
	Template Name: Chapter Houston
*/

setup_pagelines_template();

add_action('pagelines_before_main','asf_chapter_title');
	function asf_chapter_title() {
		print('FOO!');
	}

I can get the code using add_action to work in the functions.php file but not the template. Am I missing something?

Share this post


Link to post
Share on other sites
Rob

Hi,

 

Adding a child theme or PageLines Customize plugin lets you safely add a hook.  Those can affect a section used on a template, but you cannot write to the template itself, as that's core code.  It would also be a pretty good way to crash the entire site.   Using hooks will allow you to add customizations via the hook and apply it to a section, which is then applied to the template.

 

Basically, you're getting what you desire, but in a few standard steps.


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×