WP THEME

From KOP KB
Revision as of 20:03, 9 March 2016 by ReMaster (talk | contribs) (Use your own css for the login)
Jump to: navigation, search

This will be about certain codings to customize your wordpress theme even further.

Custom Page Inherit Theme

If you upload a custom PHP file which you would like to inherit your WordPress Theme include the below code at the top of that PHP file then add it to your theme's folder (e.g. inside of the twentysixteen folder).

When you add a new page in wordpress you can choose a template on the right hand side. this template list should now include the Template name you have included in your file (in this case, "Full Width Page").

<?php
/**
 * Template Name: Full Width Page
 *
 */

SOURCE: https://developer.wordpress.org/themes/template-files-section/page-template-files/page-templates/

Functions

Adding Header Image Function

The following below is basic header image function for the wordpress site. You can change the file path and change the width and height as necessary. This code would go within the functions.php file of your template.

add_action( 'init', 'register_my_menu' );
$args = array(
	'width'         => 960,
	'height'        => 198,
	'default-image' => get_template_directory_uri() . '/images/header.jpg'
);
add_theme_support( 'custom-header', $args );

Use your own css for the login

Working within the functions.php again. You can use this to refer to your own css file within your template directory just for the login page.

function my_login_stylesheet() {
    wp_enqueue_style( 'custom-login', get_template_directory_uri() . '/login/logins.css' );
    
}
add_action( 'login_enqueue_scripts', 'my_login_stylesheet' );