I am updating an installation of buddypress (1.5) to the most recent version (2.1.1). I have updated the files and am now trying to update the theme to use the template hierarchy pattern.
For this I created the following directory structure within my theme:
my-theme/
buddypress/
groups/
index-directory.php
index-directory.php contains a single die('debug') statement for testing.
If I copy this buddypress directory into the twentyfourteen directory and activate that theme, I am seeing the debug message when I'm on the group listing page. However, when I use my custom theme, the message is not showing up.
This tells me that the template hierarchy is not being applied on my theme. Why could that be?
I suspect that somehow my theme is being treated as a legacy theme, I don't understand why though. I commented out the whole functions.php to make sure it's not because of aynthing in there. The header comment in the style.css does not contain anything special either.
Any help on this?
Thanks.
The problem was my own mistake. Our theme stylesheet had a Template: bp-default in it. I didn’t notice it at first because our theme is named similarly and my mind read it as the title of our theme. If I remove it, my templates are included.
For anyone stumbling on this problem in the future, here are the reasons why the template hierarchy could be deactivated by Buddypress:
Theme compat is disabled when a theme meets one of the following criteria:
1) It declares BP support with add_theme_support( 'buddypress' )
2) It is bp-default, or a child theme of bp-default
3) A legacy template is found at members/members-loop.php. This is a
fallback check for themes that were derived from bp-default, and have
not been updated for BP 1.7+; we make the assumption that any theme in
this category will have the members-loop.php template, and so use its
presence as an indicator that theme compatibility is not required
https://buddypress.org/support/topic/default-theme-is-still-showing/
Related
I want to override woocommerce templates from my theme. I follow all the steps from the official documents of woocommerce. And I'm sure that there is no woocommerce.php file in my theme.
So, I can;t understand why it isn't working.
I'm using twenty seven theme.
Any help will be appreciated.
I had an issue with this relating to the WooCommerce template cache.
The cache can be cleared by navigating to:
WooCommerce > Status > Tools > Clear template cache
If you've already read this documents
https://docs.woothemes.com/document/template-structure/
Please Note: When creating woocommerce.php in your theme’s folder, you will
be unable to override the woocommerce/archive-product.php custom
template in your theme, as woocommerce.php has priority over all other
template files. This is intended to prevent display issues.
Also make sure that you don’t have “Template Debug Mode” activated that you can find under:
WP Dashboard -> WooCommerce -> System Status -> Tools
Try to declare Woocommerce support in your theme's function.php
After lots of researching, finally I've found my answer from here WordPress - Failing to override woocommerce templates
Actually, I use all of my files inside the template folder and this is the reason why it didn't work.
So simple steps. But I can't understand how was I miss it!
Thank's Mo'men Mohamed for your suggetions.
Yes i agree with Mobashir.
There are three steps to check why override not working :
Check in functions.php for woocommerce supported added ( URL : https://docs.woocommerce.com/document/woocommerce-theme-developer-handbook/ )
Check spelling of directory and files is proper in theme such as your-theme/woocommerce. ( URL : https://docs.woocommerce.com/document/template-structure/ )
Woocommerce allow to change the location of woocommerce template. Hook is : woocommerce_template_path .If you are using the premium theme then check for filter hook in your theme's functions.php file. If that hook exits then use that location which is mention in that hook's callback function.
I'm facing the same issue. I am using the JupiterX theme with Elementor and trying to override the checkout template in the JupiterX Child theme, but it's not loading. I have double checked the path, it's like themes/jupiterx-child/woocommerce/checkout/form-checkout.php.
Solution:
I have resolved the issue. Actually, the JupiterX theme has its own WooCommerce overriding structure, that is themes/jupiterx/lib/templates/woocommerce/checkout/form-checkout.php and the same for the child theme that is themes/jupiterx-child/lib/templates/woocommerce/checkout/form-checkout.php.
For more details: themes.artbees.net/docs/overriding-woocommerce-templates
I have a child theme that uses the new Jetpack Portfolio Project custom post type and wish to modify archive.php to display custom results.
I'm using: WordPress v3.9.2; Theme: Child of Point, Jetpack is installed with Custom Content Types enabled, and Portfolio Projects selected in the Settings. (No other plugins that implement portfolio functionality are installed.)
According to the Codex:
Template Files
In the same way single posts and their archives can be displayed using
the single.php and archive.php template files, respectively,
single posts of a custom post type will use single-{post_type}.php
and their archives will use archive-{post_type}.php
and if you don't have this post type archive page you can pass BLOG_URL?post_type={post_type}
where {post_type} is the $post_type argument of the
register_post_type() function.
My understanding is that if you create files called single-jetpack-portfolio.php and archive-jetpack-portfolio.php within the child theme, WordPress will automatically use those files in place of single.php and archive.php respectively.
However, my child theme successfully calls single-jetpack-portfolio.php, but completely ignores archive-jetpack-portfolio.php, instead calling archive.php in the child.
I am stuck for a solution.
From the codex above, adding to the URL "?post_type=jetpack-portfolio" does cause the child theme to correctly use archive-jetpack-portfolio.php, but should I need to be manually modifying every single URL to explicitly specify this? Should WordPress not automatically be detecting this, as it does for the single-jetpack-portfolio.php file? How can I solve this?
I have tried:
Resetting the permalinks in case it was related to that (changing the option in Settings and saving and back again)
Adding an archive.php file to the child in addition to archive-jetpack-portfolio.php (I initially didn't have an archive.php in the child, so it used the parent's archive.php)
Publishing a new Jetpack portfolio project and updating an existing page (I read somewhere that publishing something might trigger Wordpress to see the changes)
Thanks in advance for any help.
I had the same problem described by the OP. When I visited mydomain.com/portfolio it would use the custom archive template. When I tried to view a project type it defaulted to the regular archive.php. I'm wondering if OP was viewing a project type page without realizing it.
My solution was to create a taxonomy template file. After playing around with it I figured out that
taxonomy.php
taxonomy-jetpack-portfolio-type.php
taxonomy-jetpack-portfolio-type-{name-of-project-type}.php
all worked correctly, depending on how specific you wanted to get.
There's more info at the wordpress codex: http://codex.wordpress.org/Template_Hierarchy#Custom_Taxonomies_display
Hope this helps someone.
I will be working on this the next days.
You should try this in the child archive.php first lines:
<?php
if( is_post_type_archive('jetpack-portfolio') )
get_template_part('content', 'jetpack-portfolio');
elseif( is_tax('jetpack-portfolio-type') || is_tax('jetpack-portfolio-tag') )
get_template_part('archive', 'jetpack-portfolio');
else continue;
?>
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.
In the WordPress 'Install Themes' option I have installed a theme called Facelook but after successful installation when I tried to activate it, following message appeared.
The following themes are installed but incomplete. Themes must have a
stylesheet and a template. Name: Facelook. Description: The parent
theme is missing. Please install the "bp-default" parent theme.
Where I can install bp-default? What does this error message mean?
Sounds like the "Facelook" theme is a child theme of the "bp-default" theme. You'll need to locate the bp-default theme and install it before you can use Facelook.
Check all uppercase/lowercase characters in the theme folder name match EXACTLY to the theme reference inside Style.css match.
Often when Wordpress complains that a theme is not installed (either when trying to use the theme, or when referencing the parent from a child-theme), it is because of an uppercase/lowercase mismatch.
For example:
inside style.css...
Template: supertemplate
is not the same as the folder name "Supertemplate"
Seems trivial, but something to check.