I've created a custom page(template), in fact, at this moment, I did a blank page, like, page-newpage.php(inside child theme dir structure), I've also already created a page called "newpage" and it is partially working, I mean, the page runs ok, but with parent theme(beClinic) header and footer.
Can someone give me a clue about how to remove theme header and footer?
Thanks!!!
In your page-newpage.php may be you have added below code.
get_header(); - This call header.php file of the active theme/parent theme
get_footer(); - This call footer.php file of the active theme/parent theme
In order to remove header and footer, you need to remove above functions from your your page-newpage.php
But if you remove, then WordPress functions will not work in your page-newpage.php
So what you can do is create custom header and footer for your page-newpage.php
go through this in details
Related
I am new in WordPress,
I want to know how to add footer other then default footer
( example: Footer file name - home-footer.php and need to use for home page, same as contact-us-footer.php for contact us page ). let me how i can achieve this.
if you are adding your files in theme or WordPress core files then this will automatically remove when your WordPress will be updated unless you creat child theme so just better to create to footers with any page builder I recommend elementor and then hide that with page id you will find that in the body tag of every page like this
.page-id-111 .footer{
display:none;}
Let me know if you don't understand anything
You have to name the file footer-home.php. Then you can call this footer in the page template (i.e. page-home.php) using get_footer('home').
Wordpress will use the right file, if it is named correctly starting with footer-*.php.
I want to disable the footer of every page in WordPress, how can I do that?
Rafael
It depends on the theme. Look in /wp-content/themes/[your activated theme] folder. What theme are you using? There you should find template files for pages, single posts, post archives, header, footer, and more. The easiest way would be to edit the footer.php so that it is empty. Ideally, you'd make a child theme of the active theme and only include the files needed to create the child theme and the ones you were changing.
https://developer.wordpress.org/themes/advanced-topics/child-themes/
The following may work:
add_action('get_footer', function(){
ob_start(function($buffer){
return preg_replace('#<footer.+</footer>#', '', $buffer);
});
});
The action 'get_footer' is called before the footer template file is loaded and causes PHP to buffer the output of the footer template. When the script ends the callback of ob_start() will be called and it will remove the footer from the output buffer. This of course assumes the footer is bracketed by <footer> and </footer> which is standard practice.
I need to apply the same content on over 4000 Wordpress pages. Now to make it as easy as possible. I create a single page and designed it with the content. So what I want to do now is create a template out of this page. Is there any possibility to export the page as php code to put it in the theme as a template?
(It hast to be the exact content as the template file)
I am also open-minded for other Ideas to solve this problem. Thanks a lot!
Yes, you can create a template and apply your template to your pages.
With the content that you wish to apply to your pages, create a .php file. At the top of this.php (called say page-mycontent.php) file add this header:
<?php
/* Template Name: My Template */
?>
Now the template will appear in the admin panel for Page - Edit on the right hand side.
Code Changes in header.php and page.php
Your changes are in both the header and the loop. So I suggest creating two templates, one for the header and one for the body.
In your header.php, if you name your header code as header-myheader.php then pull your new header template into header.php like so:
<?php get_header('myheader'); ?>
And similarly add your body code (called mytemplate.php say) into page.php like so:
<?php get_template_part('mytemplate'); ?>
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.
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 .