WordPress: How can I disable the footer of all pages - wordpress

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.

Related

Wordpress - Child Theme Template Page

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

Add comments to wordpress inspect element page

As the title says, I want to add some sort of signature with comments on my wordpress index file, thing is - there are 30 different index files and none of them seems to work
If I understand correctly, it'll just be a case of adding some HTML comments (not PHP comments as they won't show in the source code) in your theme files. Bear in mind that editing a theme won't work if someone else made it and releases updates to it as it'll overwrite your changes if you update it.
The best place to add in the comments is to either open the header.php file and place your HTML comments after the opening <body> tag. If your theme doesn't include a header file, you could always add your comments to the top of your themes index.php file instead.
Your theme should be located within /wp-content/themes/YOUR-THEME/.
Alternatively, you could also place HTML comments between the <head> tags of your theme so they show up a bit higher in the source code. To do this, it's probably best to use an action hook instead. Place this in your themes functions.php file:
add_action( 'wp_head', 'add_signature_to_theme', 1, 0 );
function add_signature_to_theme() {
?><!-- Welcome to my website. --><?php
}
The wp_head action hook documentation is useful to have as reference as well if you'd like a bit more information on what it is and what it does.

Fields disappear for a specific theme

I'm new to drupal, so sorry in advance or any mistake, feel free to correct.
I don't really know what exactly that I have done cause the problem, but content's fields (for all content types)
is not being shown (the pages are empty beside the title).
When I edit the information it appears.
In the past the information appeared.
It happens only for a specific theme (business_theme), for other themes (drupal's default) the info' appears.
any idea or help will be great
You need to assign Main page content block to a region that already exists in your theme.
First; Declare the region in your theme's .info file.
regions[content] = Main Content
Second; Print the region inside your page.tpl.php file.
print render($page['content']);
Last; Assign the Main page content to the region from the Blocks manager page. ?q=admin/structure/block
After further investigation, It seems that when our own theme is being the default, no node.tpl.php is being called (does that makes sense?).
I add the code
<?php
print '<pre>';
var_dump(get_defined_vars());
print '</pre>';
?>
to each node*.tpl.php file and cleared all caches.
when our theme is working no changes appeared,
when enabling batrick theme the added code was working.
This happens only in the page itself, i.e. when entering to localhost/drupal/node...
in the front page the added code worked for both themes.
any ideas?
tnx

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.

Add dynamic content before the loop in Wordpress

I'm developing a content slider for Wordpress and I would know how is possible to put this content slider (as html content) into the body before the loop.
I tried to filter the content with add_filter('the_content', 'functionName), but I get the content slider before each post.
If you use add_filter('the_content'), your function will be called everytime the content of a post is output, whether a single post or a series of posts in a loop. If you need to "hook" before any post content is output in a page, the only dynamic parts of all WP themes you can reach are get_header() or get_sidebar() (or event get_footer). So your best luck would be not to use a filter with the content, but an action, with get_header, like this :
add_action('get_header', 'your_function'); // Add priority & param args if necessary
The problem is that this gets executed before header.php is called, and usually, the body tag is opened in header.php...
That is if you cannot modify the theme itself. Otherwise, you can easily add an action in the theme itself and execute it where you want.
Another technique would be to add your html content after document is ready, through JavaScript which you can output in the footer.

Resources