Hello I'm using wordpress theme livewire version 2.0, when I use the editor in theme update the edited file, for example footer.php I changed the text and add some. It is saved when I view the profile but when i look the template and look at the footer it never changed even if I delete the lines in footer.php nothing changed. Why is this happening? Thanks in advance
You should find out which file was included exactly as a footer. So if you should find the relevant template files such as index.php to see if it include footer.php as footer or any other files or just hard coded there
Related
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.
The WP theme I am working on uses get_template_part('foobar'); a lot in various places. Where should I search for the block's code? Is it in functions.php or in other files?
get_template_part('foobar'); is same as require 'foobar.php';. So you have a file named as foobar.php in your theme root directory.
See https://wordpress.stackexchange.com/questions/9978/how-to-use-get-template-part
I have 3 themes set up right now and I need them all to inherit partials from the same source in order to update all three themes at the exact same time when I change any of those partials.
I'm seeing that
include("../../../includes/vital/partial.php");
doesn't work from within single.php or any other other theme template file. The error I get is:
Warning: include(): Failed opening '../../../includes/vital/partial.php' for inclusion (include_path='.:/usr/local/Cellar/php56/5.6.8/lib/php') in /Users/insertusername/Documents/Code/Projects/wordpress/wordpress-1/wp-content/themes/flowerz-mobile/single.php on line 7
How can I make this work?
Thanks!
Since Wordpress loads all based on the main index.php the code below worked for me in every theme.
include("includes/vital/partial.php");
that`s right, without any ../ at the begining.
I'm running Wordpress 3.3.1.
I'm writing a child theme that modifies the default twentyeleven theme. Everything seems normal, except that when I add a custom page template, it doesn't appear in the add/edit screen (so I can't use it!).
To elaborate on "normal", here's what IS working:
My child theme appears and activates normally.
My CSS code (in style.css) is appearing.
My files from the template hierarchy are working (ex: front-page.php, page.php)
I've read and reread the codex, and my custom page template file ("coming-soon.php") seems to have the correct header:
<?php
/*
Template Name: Coming Soon
*/
So why won't it show up under the "Template" drop-down???
I've added custom templates dozens of times and never had this problem. The only possible difference I can think of is that I'm writing a child theme (even though the codex says this shouldn't matter), or perhaps it's a difference in the newest update of WP.
I can't duplicate what you're seeing with a clean install of WordPress 3.3.1. I have a theme with just two files, style.css, containing:
/*
Theme Name: stackoverflow-8946077
Template: twentyeleven
Version: 0.0.1
*/
#import url("../twentyeleven/style.css");
and coming-soon.php, containing:
<?php
/*
Template Name: Coming Soon
*/
get_header();
?><h1>Coming Soon</h1><?php
get_footer();
?>
the first part of which was copied from your question.
I see the template as expected:
The only things I can think of are to double-check:
the file exists on the server you're running on
the file's in the child template's directory (though it should work if it's in the twentyeleven directory)
there's no file with the same name in the twentyeleven directory, which (I think) would take precedence
the file name ends in .php
you only have a single space between "Template" and "Name:" (the regex used contains the literal Template Name:)
Failing that, the dropdown is populated by the get_page_templates function in wp-admin/includes/theme.php. Might be worth sticking some debug code in there to see if the $templates variable includes coming-soon.php.
This is an old thread. But if anyone is looking for solutions now, it may be the issue in WP 4.9. More details: Templates not working properly
In my situation, it ended up being the file permissions. I set it to 755 or whatever the standard WP permission is (in regards to security) and it worked!
Mine also ended up being the file permissions.
I set it to 777, and it worked like a charm!
I am using WordPress 3.2.1 ,
Page template selection drop down is missing on Pages (Add,Edit)
wp-admin > Pages >Add New > Page Attributes
I Edit the Template Page Default page as below code
/*
Template Name: New Template
*/
But still the template drop down no visible , my older version of WordPress it display by default.
Following is the screen shot for more idea
I solved this problem solved by adding the typical following code:
/*
Template Name: Custom
*/
Don't add any spaces after Name:
It'll work if you use template name: as well.
It might help someone: check if your index.php file is in place.
If it's not there, wordpress treats the template as corrupt and it doesn't display the template selection.
This should be simple to troubleshoot. The requirements for the page template to work are straight forward:
The template needs the page title in the top of the file like you've shown (the title needs to be wrapped in a PHP tag, you probably just didn't add it with your example bu I want to make sure you havne't overlooked it):
<?php
/*
Template Name: Custom
*/
?>
The second requirement is that the file is in the root of the theme folder.
With those two requirements in place, it should work. If it isn't working you nave a few possible issues. I list a few off the top of my head:
You might need to re-install WordPress in-case a file was corrupted
during your last update.
It's possible someone has altered the WP-Admin layout using users
roles.
That's all I can thing of at the moment, let me know how it turns out.
I had the same issue. It actually turned out to be a missing style.css file within the template directory in my case.
This happens because the get_post_templates() in class-wp-theme.php first checks for errors. If it finds any then it returns an empty array (no templates are displayed).
A side effect of this is that saving a page would clear the existing template and use the page.php instead.
So in short if the errors() method of your theme returns any errors then no templates dropdown.
hope that helps someone.
Same issued, I found out that in appearance panel in your WordPress dashboard the stylesheet is missing. You shouldn't rename the style.css in your theme folder.
Not sure if this will help anyone, but we solved the problem by disabling our theme and re-enabling it again. We had some other theme folders in the theme directory that we weren't using so we deleted those out as well. good luck, it's a really random problem to solve!
yeah!template dropdown not showing because you have no template So how to solve this::---
1 create template folder in theme
2 create a template in this folder
like:-
<?php /* Template Name: Home */ echo "template"; ?>
and check-in page dropdown will be there.