page-slug goes to not found

A template is not a page you can load directly. A template is used for the formatting (‘building’) of a ‘page’ (created via Page, Add) or ‘post’ (created via Post, Add). On that page/post editing page, there is a place to specify the template that the WP will use when the page is output. There … Read more

Can you call a template file without assigning template to a page in the admin panel?

You can hook into template_redirect like this: function custom_template_redirect() { global $wp; if ($wp->query_vars[‘pagename’] == ‘my-page-slug’) { // check the page slug status_header(200); // a 404 code will not be returned in the HTTP headers if the page does not exists include(TEMPLATEPATH . “/test.php”); // include the corresponding template die(); } } add_action( ‘template_redirect’, ‘custom_template_redirect’ … Read more

wp_title() handling of author page

I see my name in the title when viewing author pages. wp_title() runs this code during execution.. // If there’s an author if ( is_author() ) { $author = get_queried_object(); $title = $author->display_name; } Perhaps your author(s) don’t have a display name set? Additionally be sure to try disabling plugins that may be hooking a … Read more

Use is_category(), is_tag(), … in functions.php

Your problem is that you didn’t wrap it in a callback, but executed it immediately when functions.php was loaded by core. By then the global $wp_query object isn’t initialized fully and the is_category() etc. wrappers can’t deliver what you are expecting them to do. So your if/else checks should be moved inside the callback like … Read more

Grabbing the page template name?

An alternative to @Ben Cole that’s less intensive (especially if you have several page templates), but not as awesome because it doesn’t use the WP_Theme object 😉 function wpse_184317_get_template_name( $page_id = null ) { if ( ! $template = get_page_template_slug( $page_id ) ) return; if ( ! $file = locate_template( $template ) ) return; $data … Read more

Custom template for each page

there are a few way you can do that: Template Hierarchy – each page with is own theme file using page-{ID/slug}.php Custom Page Templates – Individual Pages can be set to use a specific custom Page Template from the edit screen. but if you are just looking to change whats on the sidebar then there … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)