Calling function depending on page type

1 view
Skip to first unread message

Adam

unread,
Apr 21, 2008, 5:59:01 PM4/21/08
to habari-users
Maybe I am going about it the wrong way, but I have my archive
function:
<?php echo $monthly_archives; ?>
sitting in my page.single.php but I only want to call it when I am
viewing the page with slug 'archives'. A: Can I do this, B: If so how,
C: Is there a better way of doing it?

That is how I am attempting to do this, maybe my Wordpress fuzzled
brain is too set in its ways to understand the new fangled Habari
thinking straight away.

Michael C. Harris

unread,
Apr 21, 2008, 6:01:17 PM4/21/08
to habari...@googlegroups.com
On Mon, Apr 21, 2008 at 02:59:01PM -0700, Adam wrote:
>
> Maybe I am going about it the wrong way, but I have my archive
> function:
> <?php echo $monthly_archives; ?>
> sitting in my page.single.php but I only want to call it when I am
> viewing the page with slug 'archives'. A: Can I do this, B: If so how,
> C: Is there a better way of doing it?

Name the template page.archives.php.


--
Michael C. Harris, School of CS&IT, RMIT University
http://twofishcreative.com/michael/blog

Michael C. Harris

unread,
Apr 21, 2008, 6:02:17 PM4/21/08
to habari...@googlegroups.com
On Tue, Apr 22, 2008 at 08:01:17AM +1000, Michael C. Harris wrote:
>
> On Mon, Apr 21, 2008 at 02:59:01PM -0700, Adam wrote:
> >
> > Maybe I am going about it the wrong way, but I have my archive
> > function:
> > <?php echo $monthly_archives; ?>
> > sitting in my page.single.php but I only want to call it when I am
> > viewing the page with slug 'archives'. A: Can I do this, B: If so how,
> > C: Is there a better way of doing it?
>
> Name the template page.archives.php.

Oh, and see http://wiki.habariproject.org/en/Template_File_Hierarchy
for more file template details.

Adam

unread,
Apr 21, 2008, 6:18:09 PM4/21/08
to habari-users
Ah, that makes sense.
What a thoroughly intelligent system!

Many thanks.


On Apr 21, 11:02 pm, "Michael C. Harris" <michael.twof...@gmail.com>
wrote:
> On Tue, Apr 22, 2008 at 08:01:17AM +1000, Michael C. Harris wrote:
>
> > On Mon, Apr 21, 2008 at 02:59:01PM -0700, Adam wrote:
>
> > > Maybe I am going about it the wrong way, but I have my archive
> > > function:
> > > <?php echo $monthly_archives; ?>
> > > sitting in my page.single.php but I only want to call it when I am
> > > viewing the page with slug 'archives'. A: Can I do this, B: If so how,
> > > C: Is there a better way of doing it?
>
> > Name the template page.archives.php.
>
> Oh, and seehttp://wiki.habariproject.org/en/Template_File_Hierarchy
Reply all
Reply to author
Forward
0 new messages