• I want to use a custom template in my theme, but I can not use it as a page-template, because I want to release the theme.

    Is there any way to link to a template without using it as a page-template or something? I want to use a typical link anywhere in the theme.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter p0mmeluff

    (@p0mmeluff)

    Is this a good or bad way to solve it?

    Link on index.php gets the following code:
    <a href="?=blubb_archives">archive</a>

    Function in functions.php:

    $current_qry = $_SERVER['QUERY_STRING'];
    $required_qry = '=blubb_archives';
    
    if ( $current_qry == $required_qry ) {
    	function blubb_archives () {
    		include(TEMPLATEPATH . '/archives.php');
    		exit;
    	}
    	add_action('template_redirect', 'blubb_archives');
    }

    What it does:
    If the current url contains the query “blubb_archives”, the function loads and displays archive.php

    I am using the link only at the frontpage (index.php) and nowhere else.

    Thread Starter p0mmeluff

    (@p0mmeluff)

    Seems as if I am the first to solve this problem, eh? 😀

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to link to a template’ is closed to new replies.