开发者

How Can I Apply a WordPress Child Theme to Only Some Pages and Not the Whole Site?

I've got a WordPress child theme called Kid based on the Suffusion theme.

The Kid theme just changes the content div's widt开发者_开发百科h to 640px. I want to apply the Kid theme to only some pages and not to others.

How do I apply a child theme to only one page and not to the whole site?

Thank you.

-Laxmidi


When you edit a page, on the righthand side underneath "Page Attributes", you can choose a different template to apply to that page only.

If on the other hand, by "pages" you mean posts that flow to page 2, page 3 etc.. you may want to take a look at this post.

EDIT:

Okay, I follow you now. You are going to need to create a new page template in your child theme. Then, you can follow the above directions to select that new template. Here is a good reference on how to create a new page template in your child theme.

Hope this helps,

John


I don't have much experience with child themes, but another method you can use is making page-specific template files in Wordpress themes.

I would recommend duplicating the page.php file in the child theme and renaming it page-"slug".php or page-"id".php - "slug" being the part at the end of the permalink, or "id" being the id number of the page. This is the template file hierarchy, which you can find out more about here.

This is where my lack of experience with child themes will show, but I think you can then remove the page.php from the child template, and it will use the parent's page.php file for all pages except for that specific one. Not 100% sure on this last part though.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜