Wordpress Custom Themes

From KOP KB
Revision as of 18:19, 17 January 2017 by ReMaster (talk | contribs) (Simple Header Image)
Jump to: navigation, search

Intro

Basically some simple info about making and starting to create your own Wordpress template.

Basic Requirements

The files that you can use with a Wordpress Template that are integrated are listed here: https://codex.wordpress.org/Theme_Development

The ones that are absolutely required for wordpress admin panel to recognize it is below:

style.css index.php

This is a very basic one and if you feel like you need more functionality you can look through the link above.

Functions and Styles

Now there is definitely other ways to do these things but this is the way I managed.

Simple Header Image

Basically just adding a header image option for the top of each page. Lets you set the height and width was well where the default image gets set. This code would be within the functions.php file within your Theme folder. Pretty much the function is all the dirty work and the them support part says start it up.

function register_my_menu() {
  register_nav_menu('header-menu',__( 'Header Menu' ));
}
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 );

Login Page

Login related functions and edits

Locking it Down

Pretty much only time you really want login errors to show is when your testing something out, otherwise wordpress lets on too much. This command in the functions.php hides them. You can use css to hide it completely or just null the message and still have the red bar show up.

add_filter('login_errors',create_function('$a', "return null;"));