Wordpress template question - wordpress

I set a template and my default 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 :)
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").
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".
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.

Related

drupal 7 panels landing page, how to remove default theme elements

I'm drupal beginner, and can't solve problem with landing page. I create landing page with panels, set custom css code to it but it doesn't look how I want. I see default elements from my theme (header, nav-menu, etc.) on it. I want that layout fill all my page, how can I achieve it?
I have it
I want do like it
well, I found solution for this problem. I use bootstrap 3 sub theme, and there is file who provide page template, it calls node.tpl.php. I just remove string <div class="main-container <?php print $container_class; ?>"> and now it works well.
go to page.tpl.php file, remove the lines that render the header, the logo and the title. They would usually be in an if statement and the varibles are $logo, $site_name, $main_menu, $title.

Custom template doesn't accept shortcodes

I've created a custom template by copying page.php and then removing basically everything except for the CSS link, so it looks like this:
The div on line 20 just puts a red box on the page so I can recognize that this template, and the linked CSS file, are handling the page. (The idea is to create a large blank page where I can put large tables. I don't want any header markup or sidebar markup, etc., to distract attention from the table.)
I see the red box fine, but when I try to insert a shortcode on the page, to insert a table from TablePress, the shortcode isn't processed. I assume I removed something from page.php that is needed to process shortcodes, since a normal new page, that uses page.php, processes the shortcode fine. Does anyone know what I might have removed that killed the shortcodes?
Thanks.
Two thoughts about your code / problem:
1) I think you should not insert the stylesheet link like this. See: https://codex.wordpress.org/Function_Reference/wp_register_style
2) You can insert the shortcode with
<?php
echo do_shortcode('[ShortcodeName]');
?>

How to name different footer files which can be selected in wp-admin's page editors

Seen this done before in other templates, just wondering if anyone here knows how to do this.
I have one template I have created, and two hard coded footer files. footer.php and footer-1.php.
I want to be able to select between using either footer.php or footer-1.php in wp-admin via the pages editor.
So far all I have found so far is adding something like this to the top of the file:
Template Name: footer_1
However, this requires that a secondary header and other files are also included, it won't allow just a change of footer alone.
Can anyone tell me how I can name different footer files so that wordpress detects them in wp-admin and allows me to switch between them.
I do not require adding widgets to these, there is simply two styles of footer and they have no correlation to page or category to hard code, they have to be selected in the admin area manually.
To dynamically change your footer with a admin editor option, do the following:
Open the page you want to customize in editor
Locate Custom Fields meta box in editor (If it is not visible tick the box Custom Fields in the Screen options dropdown at top right)
Select Add Custom Field in Custom Fields meta box
Enter footer_template in Name field and an arbitrary id in the Value field
Select Update to save your settings
Open your theme folder and locate page.php file
Open page.php file and locate the very last line <?php get_footer(); ?>
Delete the line in step 7 and add the following:
<?php
$scriptonomy_footer_meta = get_post_meta(get_the_ID(), 'footer_template', true);
get_footer($scriptonomy_footer_meta); ?>
Save and close page.php file
Make a duplicate of footer.php and name it footer- plus any arbitrary id you chose in step 4, ie: footer-1.php or footer-two.php
Now you can assign any custom footer to any page. You can do the same for the header as well using this technique.

wordpress. error creating content for custom templates with twentytwelve theme

i'm using the twentytwelve theme and i have to write custom content into my example template.
I want to maintain my header content so the main structure is the following
header = id page, wrapper
ex.page = primary, content
footer = close wrapper, close id page
If i have understood correctly, if i want to insert content into the middle of my page i have to do it into my template page (that is a copy of the main page.php), that is in the middle between my header and my footer
For example i want to insert a div into which insert the loop of such category.
The problem is that it displays me nothing, like i've wrote nothing. I can only see the contents if i erase all the originary div, but it's not what i want to do, just because the only div is the page which is my container.
I can't catch what i have to do.
Can you tell me what i forgot to do?
Thanks,
Alex
page.php is a "master" document. header.php, footer.php and (if it exists) sidebar.php are all imported into page.php. Twenty Twelve also uses atomized content templates. You may need to add your div to content-page.php, which is also imported into page.php. content-page.php is used inside the wordpress loop, and encapsulates the code that pulls in the actual article elements from the wordpress database.
If you are trying to add straight HTML to the templates, ensure that you are not adding code between the php brackets:
<?php // don't add html here ?>
<div>do add html here</div>
Depending upon the type of wordpress page you are trying to display, you may need to consult the Wordpress Template hierarchy to determine the proper Wordpress naming convention for your template file (the copy of page.php).
Technically speaking, everything in content-page.php can be put into page.php replacing the get_template_part function. All the 'content' pages are totally not required and can be combined into one file if you want simplicity.
In my opinion, it's easier to start from scratch when learning Wordpress rather than try and re-work something. The default wordpress themes don't lend themselves to be beginner friendly.

wordpress edit specific page html

For example I'm create new page in wordpress "page3" I want edit html and css of this page and add for example my contacs, how to do this ?
I'm searching in theme options, but no resut.
You can edit the page.php file but what you do to it will effect all other pages. Or you can duplciate the page.php file and call it page-3.php (Or whatever your "Page3" page ID number is). Be sure to keep the calls for the header and footer and the tops and bottoms of your page .

Resources