[SHOWTOGROUPS=3,4,14]
Stiu ca multi vor sa aiba 2 headere si 2 footere asa ca m-am gandit sa pun un tutorial (nu pentru toata lumea) care sa va ajute sa faceti acest lucru. De exemplu, pe prima pagina vreti sa puneti h1 cu Animale de companie, insa va aparea si in articol si asta este destul de nasol pentru ca stim ca trebuie sa fie doar un h1.
Prima data facem 2 fisere numite headersingle si footersingle si copiem exact ce avem in header si footer in headersingle si footersingle. Acum umblam in headesingle si footersingle, punem h1 in headersingle si h2 in footersingle (eu asa procedez) si apoi in index.php modificam sa apara headersingle si footersingle. Ultima data, modificam in wp-includes/general-template.php si dupa functia header respectiv footer adaugam:
Atentie: nu le dam replace, le adaugam dupa fiecare functie
Sau mai usor uitati exemplu:
[/SHOWTOGROUPS]
Stiu ca multi vor sa aiba 2 headere si 2 footere asa ca m-am gandit sa pun un tutorial (nu pentru toata lumea) care sa va ajute sa faceti acest lucru. De exemplu, pe prima pagina vreti sa puneti h1 cu Animale de companie, insa va aparea si in articol si asta este destul de nasol pentru ca stim ca trebuie sa fie doar un h1.
Prima data facem 2 fisere numite headersingle si footersingle si copiem exact ce avem in header si footer in headersingle si footersingle. Acum umblam in headesingle si footersingle, punem h1 in headersingle si h2 in footersingle (eu asa procedez) si apoi in index.php modificam sa apara headersingle si footersingle. Ultima data, modificam in wp-includes/general-template.php si dupa functia header respectiv footer adaugam:
function get_headersingle( $name = null ) {
/**
* Fires before the header template file is loaded.
*
* The hook allows a specific header template file to be used in place of the
* default header template file. If your file is called header-new.php,
* you would specify the filename in the hook as get_header( 'new' ).
*
* @since 2.1.0
* @since 2.8.0 $name parameter added.
*
* @param string $name Name of the specific header file to use.
*/
do_action( 'get_headersingle', $name );
$templates = array();
$name = (string) $name;
if ( '' !== $name ) {
$templates[] = "header-{$name}.php";
}
$templates[] = 'headersingle.php';
locate_template( $templates, true );
}
/**
* Fires before the header template file is loaded.
*
* The hook allows a specific header template file to be used in place of the
* default header template file. If your file is called header-new.php,
* you would specify the filename in the hook as get_header( 'new' ).
*
* @since 2.1.0
* @since 2.8.0 $name parameter added.
*
* @param string $name Name of the specific header file to use.
*/
do_action( 'get_headersingle', $name );
$templates = array();
$name = (string) $name;
if ( '' !== $name ) {
$templates[] = "header-{$name}.php";
}
$templates[] = 'headersingle.php';
locate_template( $templates, true );
}
function get_footersingle( $name = null ) {
/**
* Fires before the footer template file is loaded.
*
* The hook allows a specific footer template file to be used in place of the
* default footer template file. If your file is called footer-new.php,
* you would specify the filename in the hook as get_footer( 'new' ).
*
* @since 2.1.0
* @since 2.8.0 $name parameter added.
*
* @param string $name Name of the specific footer file to use.
*/
do_action( 'get_footersingle', $name );
$templates = array();
$name = (string) $name;
if ( '' !== $name ) {
$templates[] = "footer-{$name}.php";
}
$templates[] = 'footersingle.php';
locate_template( $templates, true );
}
/**
* Fires before the footer template file is loaded.
*
* The hook allows a specific footer template file to be used in place of the
* default footer template file. If your file is called footer-new.php,
* you would specify the filename in the hook as get_footer( 'new' ).
*
* @since 2.1.0
* @since 2.8.0 $name parameter added.
*
* @param string $name Name of the specific footer file to use.
*/
do_action( 'get_footersingle', $name );
$templates = array();
$name = (string) $name;
if ( '' !== $name ) {
$templates[] = "footer-{$name}.php";
}
$templates[] = 'footersingle.php';
locate_template( $templates, true );
}
Atentie: nu le dam replace, le adaugam dupa fiecare functie
Sau mai usor uitati exemplu:
<?php
/**
* General template tags that can go anywhere in a template.
*
* @package WordPress
* @subpackage Template
*/
/**
* Load header template.
*
* Includes the header template for a theme or if a name is specified then a
* specialised header will be included.
*
* For the parameter, if the file is called "header-special.php" then specify
* "special".
*
* @since 1.5.0
*
* @param string $name The name of the specialised header.
*/
function get_header( $name = null ) {
/**
* Fires before the header template file is loaded.
*
* The hook allows a specific header template file to be used in place of the
* default header template file. If your file is called header-new.php,
* you would specify the filename in the hook as get_header( 'new' ).
*
* @since 2.1.0
* @since 2.8.0 $name parameter added.
*
* @param string $name Name of the specific header file to use.
*/
do_action( 'get_header', $name );
$templates = array();
$name = (string) $name;
if ( '' !== $name ) {
$templates[] = "header-{$name}.php";
}
$templates[] = 'header.php';
locate_template( $templates, true );
}
function get_headersingle( $name = null ) {
/**
* Fires before the header template file is loaded.
*
* The hook allows a specific header template file to be used in place of the
* default header template file. If your file is called header-new.php,
* you would specify the filename in the hook as get_header( 'new' ).
*
* @since 2.1.0
* @since 2.8.0 $name parameter added.
*
* @param string $name Name of the specific header file to use.
*/
do_action( 'get_headersingle', $name );
$templates = array();
$name = (string) $name;
if ( '' !== $name ) {
$templates[] = "header-{$name}.php";
}
$templates[] = 'headersingle.php';
locate_template( $templates, true );
}
/**
* Load footer template.
*
* Includes the footer template for a theme or if a name is specified then a
* specialised footer will be included.
*
* For the parameter, if the file is called "footer-special.php" then specify
* "special".
*
* @since 1.5.0
*
* @param string $name The name of the specialised footer.
*/
function get_footer( $name = null ) {
/**
* Fires before the footer template file is loaded.
*
* The hook allows a specific footer template file to be used in place of the
* default footer template file. If your file is called footer-new.php,
* you would specify the filename in the hook as get_footer( 'new' ).
*
* @since 2.1.0
* @since 2.8.0 $name parameter added.
*
* @param string $name Name of the specific footer file to use.
*/
do_action( 'get_footer', $name );
$templates = array();
$name = (string) $name;
if ( '' !== $name ) {
$templates[] = "footer-{$name}.php";
}
$templates[] = 'footer.php';
locate_template( $templates, true );
}
function get_footersingle( $name = null ) {
/**
* Fires before the footer template file is loaded.
*
* The hook allows a specific footer template file to be used in place of the
* default footer template file. If your file is called footer-new.php,
* you would specify the filename in the hook as get_footer( 'new' ).
*
* @since 2.1.0
* @since 2.8.0 $name parameter added.
*
* @param string $name Name of the specific footer file to use.
*/
do_action( 'get_footersingle', $name );
$templates = array();
$name = (string) $name;
if ( '' !== $name ) {
$templates[] = "footer-{$name}.php";
}
$templates[] = 'footersingle.php';
locate_template( $templates, true );
}
/**
* General template tags that can go anywhere in a template.
*
* @package WordPress
* @subpackage Template
*/
/**
* Load header template.
*
* Includes the header template for a theme or if a name is specified then a
* specialised header will be included.
*
* For the parameter, if the file is called "header-special.php" then specify
* "special".
*
* @since 1.5.0
*
* @param string $name The name of the specialised header.
*/
function get_header( $name = null ) {
/**
* Fires before the header template file is loaded.
*
* The hook allows a specific header template file to be used in place of the
* default header template file. If your file is called header-new.php,
* you would specify the filename in the hook as get_header( 'new' ).
*
* @since 2.1.0
* @since 2.8.0 $name parameter added.
*
* @param string $name Name of the specific header file to use.
*/
do_action( 'get_header', $name );
$templates = array();
$name = (string) $name;
if ( '' !== $name ) {
$templates[] = "header-{$name}.php";
}
$templates[] = 'header.php';
locate_template( $templates, true );
}
function get_headersingle( $name = null ) {
/**
* Fires before the header template file is loaded.
*
* The hook allows a specific header template file to be used in place of the
* default header template file. If your file is called header-new.php,
* you would specify the filename in the hook as get_header( 'new' ).
*
* @since 2.1.0
* @since 2.8.0 $name parameter added.
*
* @param string $name Name of the specific header file to use.
*/
do_action( 'get_headersingle', $name );
$templates = array();
$name = (string) $name;
if ( '' !== $name ) {
$templates[] = "header-{$name}.php";
}
$templates[] = 'headersingle.php';
locate_template( $templates, true );
}
/**
* Load footer template.
*
* Includes the footer template for a theme or if a name is specified then a
* specialised footer will be included.
*
* For the parameter, if the file is called "footer-special.php" then specify
* "special".
*
* @since 1.5.0
*
* @param string $name The name of the specialised footer.
*/
function get_footer( $name = null ) {
/**
* Fires before the footer template file is loaded.
*
* The hook allows a specific footer template file to be used in place of the
* default footer template file. If your file is called footer-new.php,
* you would specify the filename in the hook as get_footer( 'new' ).
*
* @since 2.1.0
* @since 2.8.0 $name parameter added.
*
* @param string $name Name of the specific footer file to use.
*/
do_action( 'get_footer', $name );
$templates = array();
$name = (string) $name;
if ( '' !== $name ) {
$templates[] = "footer-{$name}.php";
}
$templates[] = 'footer.php';
locate_template( $templates, true );
}
function get_footersingle( $name = null ) {
/**
* Fires before the footer template file is loaded.
*
* The hook allows a specific footer template file to be used in place of the
* default footer template file. If your file is called footer-new.php,
* you would specify the filename in the hook as get_footer( 'new' ).
*
* @since 2.1.0
* @since 2.8.0 $name parameter added.
*
* @param string $name Name of the specific footer file to use.
*/
do_action( 'get_footersingle', $name );
$templates = array();
$name = (string) $name;
if ( '' !== $name ) {
$templates[] = "footer-{$name}.php";
}
$templates[] = 'footersingle.php';
locate_template( $templates, true );
}