Changing the default template for individual emploee

Hi There!

I would like to create a page for individual employee.

Currently it appears as a post page by default. Can I show it differently?

Hello @mothergoose,

Can you please describe what exactly you want to achieve?

Kind Regards, Roman.

Thanks for your reply.
When I am adding employee it is creating a default page for each employee, which is default single page.

Now I want the employees to be clickable ( widget has already that option), but show it little bit fancy way .

I guess I have to do it heard way, I have to create pages manually. Thanks for your reply

Hello @mothergoose,

You can create a separate .php template file for employee post type (it uses single.php by default) and put it into your child theme.

Here are useful links:
https://developer.wordpress.org/themes/basics/template-hierarchy/
https://codex.wordpress.org/Child_Themes

Please feel free to ask any other questions that you might have.

Kind Regards, Roman.

Thanks.
So if I create a new php template say for example employee.php then where do I put it? in sydney directory with other teplate files? how do I tell wp to use employee template for employee catagory?

Hello @mothergoose,

As I have already mentioned, it’s better to create a child theme and put additional .php template file there. You don’t have to tell WordPress to use it, it should recognize it automatically.

Kind Regards, Roman.

this is what i found in your link.

Single Post #Single Post

The single post template file is used to render a single post. WordPress uses the following path:

single-{post-type}-{slug}.php – (Since 4.4) First, WordPress looks for a template for the specific post. For example, if post type is product and the post slug is dmc-12, WordPress would look for single-product-dmc-12.php.
single-{post-type}.php – If the post type is product, WordPress would look for single-product.php.
single.php – WordPress then falls back to single.php.
singular.php – Then it falls back to singular.php.
index.php – Finally, as mentioned above, WordPress ultimately falls back to index.php.

So does that mean if I have a single-emplyee.php file, it will work?

Yes, actually you are telling WordPress to use it by using certain file name.

Kind Regards, Roman.

Thank you so much for your time and effort.
So I have this category "employee"
now I created another file names single-emplyee.php
It is just the copy paste of single.php, just deleted the sidebar portion.this is the part I deleted.

<?php if ( get_theme_mod('fullwidth_single', 0) != 1 ) {
	get_sidebar();
} ?>

but not working. Help please.

As a first troubleshooting step, you can install What The File plugin to make sure that your new template is used for single employees.

Kind Regards, Roman.

Hi Roman,
According to ‘what the File’ plug-in it is using single.php and template part form content-single.php.

Now what I have done is created a childtheme named sydney child theme and activated it . Created a file there called single-employee.php

No result.

I really appreciate your help on these matter as I have category that has to be shown other way that single post template, like services.

It worked. At first I created single-employee.php,as emlpoyee was my category name. but when I changed the name to single-employees.php it worked.

Well at first I thought it worked. but it makes my whole website look different. I think because i imported parrent theme in my child style.css file.

Hello @mothergoose,

It looks like this issue requires close inspection, this goes beyond our support policy. It’s considered advanced customization. As an option, you can find a reputable freelancer on Upwork for this kind of service.

Kind Regards, Roman.

Hi Roman,

Thanks for your time. I have soled the issue of child theme, it is now working ok with all colors and settings.

But now the employee template is not working again.

So this is in my child functions.php

add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'child-style',
        get_stylesheet_directory_uri() . '/style.css',
        array('parent-style')
    );
}

my template name is employees-single.php

is the naming convention correct? Can you help me resolving this issue,Please?

Hello @mothergoose,

Here is the content of child theme functions.php file that you can download here.

<?php
/**
 * Sydney child functions
 *
 */

/**
 * Enqueues the parent stylesheet. Do not remove this function.
 *
 */
add_action( 'wp_enqueue_scripts', 'sydney_child_enqueue' );
function sydney_child_enqueue() {
    
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );

}

/* ADD YOUR CUSTOM FUNCTIONS BELOW */

Your template issue seems to require some work on your website, this goes beyond our support policy.

Kind Regards, Roman.