开发者

Wordpress template question

开发者 https://www.devze.com 2023-03-15 07:28 出处:网络
I set a template and my defaul开发者_如何学编程t template is 2 columns and i have a page that i want to have a 1 column. How can I make that in wordpress? is it a code for the functions.php?

I set a template and my defaul开发者_如何学编程t template is 2 columns and i have a page that i want to have a 1 column. How can I make that in wordpress? is it a code for the functions.php?

Please suggest and thanks in advance.


You have different options and you could choose the one you prefer :)

  1. If your theme already supports a one-column page you should have on the right side of your edit page screen a box "Page attributes" with a select box named "Templates" when you could choose a different template (in default Wordpress theme "TwentyTen" is it called "One column, no sidebar").

  2. If your theme doesn't support a one-column page you could create a custom page template by yourself:

    • copy and rename "page.php" that you could find inside your theme
    • in the top comments add this line: * Template Name: The name you want for your template
    • at the bottom of page.php remove the line <?php get_sidebar(); ?>
    • now you should have the new template in the side panel "Page attributes".
  3. If you don't like the "new template + select box" way you could directly add a "IF" on your "page.php" to comment-out the get_sidebar() when needed, based on $post->ID or similar checks.

After this probably you'll have to edit your .css (adjusting width) and new-page.php (like adding a class "one-column" to the div container) to fit the dimensions.


Go to the edit page area of the page you want to have single column. Under templates (in the right hand side bar) look for "single column" or "full width" page.

90% of themes have this. If yours does not, you would have to take page.php, download it. Duplicate it and rename it to fullwidth-page.php and reupload. Make sure the comment area at the top is right according to the "page template codex" in wordpress.org. Then, delete out wehre it calls the sidebar() code. Add a bit more inline CSS to the main content area to make the inline style width the full width then.

0

精彩评论

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