Wordpress Include Functions

Wordpress Functions


First Header Include header.php template files from your current theme's directory.  If a name is specified then a specialised header- name.php  will be included.
Wordpress Functions
Wordpress Functions


Header Functions

<?php get_header( $name );  ?>

Single Header

<?php get_header(); ?>
<h2>Error 404 - Not Found</h2>
<?php get_sidebar(); ?>
<?php get_footer(); ?>


Multiple Header

<?php
if ( is_home() ) :
get_header( 'home' );
elseif ( is_404() ) :
get_header( '404' );
else :
get_header();
endif;
?>

Sidebar

get_sidebar ( string $name = null )

Load sidebar template.

Includes the sidebar template for a your theme or if a name specified then a specialised sidebar will be included. For the parameter, if the file is called “sidebar-special.php” then specify “special”.

<?php get_sidebar('my-bar'); ?>

Sidebar Left and Right


<?php get_header(); ?>
<?php get_sidebar( 'left' ); ?>
<?php get_sidebar( 'right' ); ?>
<?php get_footer(); ?>



Comments_template Functions

comments_template ( string $file = '/comments.php', bool $separate_comments = false )


function comments_template( $file = '/comments.php', $separate_comments = false ) {
    global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_ID, $user_identity, $overridden_cpage;

    if ( !(is_single() || is_page() || $withcomments) || empty($post) )
        return;

    if ( empty($file) )
        $file = '/comments.php';

    $req = get_option('require_name_email');



<?php comments_template( '/short-comments.php' ); ?>

<?php comments_template( '/custom-templates/alternative-comments.php' ); ?> 
Wordpress Include Functions Dev2Tricks 5 of 5
Wordpress Functions First Header Include header.php template files from your current theme's directory.  If a name is specified the...

Share this

Related Posts

Previous
Next Post »