Can I create new page.php on child theme in wordpress? - wordpress

I would like to create new page (with specific style) on child theme. I created a page.php on child theme, however, it doesn't work. Instead of, parent theme's pape.php does.
When I remove the parent theme's pape.php, it redirects index.php.
Can I create new page.php on child theme in wordpress?

Sounds strange. As i understood you can overload all the files in your parent-theme from the child-theme by just creating a new -filename-.php. Here is som good reading Wordpress Child Theme

Related

Child themes of twentysixteen theme

I am using twenty sixteen child theme. I need to modify the theme contents. What are the files I need to modify and how? Can anyone explain it in detail.
Advance thanks.
when i use child theme like this i get black screen
This is my site http://i.stack.imgur.com/snSX9.png How to extent the full width of my site..
Read the following documentation about the child themes
Child theme inherits all the functionality and styling of it's parent theme. If you are using child theme and a theme update is applied your changes won't be lost or overwitten
You can quickly create child theme for any theme, just follow the steps given below:
1 Create a folder and name it exactly your theme name; append -child in the name. e.g. creating child theme for twentysixteen theme would be called twentysixteen-child this folder should sit beside parent theme under wp-content/themes/
2- Your child theme should have three files.
style.css
functions.php
screenshot.png
3- In functions.php file you can override parent theme functions.
4 In style.css file you can override parent theme CSS code.
5 If you want to change header design then you have to override header.php file. For this copy header.php file of your parent theme and paste it inside your child theme folder. Now, you can modify the child theme header file as per your requirements.
6 Similarly, you can also override footer.php file in your child theme.
For more info have a look over below thread-
https://codex.wordpress.org/Child_Themes
You need to create at-least one child-theme directory and two main files (style.css & functions.php) under child theme directory. I have given example using Twenty-Thirteen WordPress theme. Step by step explanation is given

Child Theme Index.php won't override parent theme

So I've built several sites like this, using a child theme to be able to customize what I want.
This time, I have a child theme directory with a style.css and functions.php, etc.
The style sheet overrides fine, even the header.php I added overrides. However, index.php will not override the parent theme's index.php.
Anyone have any ideas?
It sounds like you've set everything up correctly, from the fact that your header.php is overriding the parent theme.
The index.php template is the final fallback if Wordpress cannot find a more appropriate template to use. Most likely, it's selecting another template from the parent theme - eg. archive.php, frontpage.php, home.php, single.php - or many others depending on which particular URL you are viewing.
This visual overview of Wordpress' template hierarchy will help you understand how it works. Using this, you should be able to locate which template file is being selected in the parent theme and therefore, which one you need to override.

Hiding Wordpress parent theme

I am using the child theme and have renamed it to the new theme name. However, the parent theme is still viewable in the admin area with the original theme name. How do I hide the parent theme? Thanks.
As far as I know this cannot be done. The idea behind child themes is to be Update Safe.
This means, you can update the parent theme and all the child theme functionality goes unaffected. If you want to hide the parent theme, you are better off forking it.
As i seen on wp-admin/themes.php file that wordpress use function called wp_prepare_attachment_for_js to collect the available theme information and then display it on themes page.
The function wp_prepare_attachment_for_js located on wp-admin/theme.php may be line 409 and seems the function have filter wp_prepare_attachment_for_js, so i think this will be done with this filter by unset the selected theme (parent theme to hide) before displayed to the available themes.
try add filter like this to your functions.php
add_filter( 'wp_prepare_themes_for_js', 'test_hide_themes', 11, 1 );
function test_hide_themes($prepared_themes){
// hide parent-theme theme
unset($prepared_themes['your-parent-theme-slug']);
return $prepared_themes;
}

Wordpress Mezzanine Flat Theme - shortcode.php in ChildTheme

It seems that an edited copy of shortcodes.php in child-theme of mezzanine flat theme is not working (does not override the parent theme)
I tried copying the whole lib folder where shortcodes.php is located but still not working. Is there anything I need to do to make it work? Other common pages of wordpress (i.e. header and page) override smoothly on child pages.
Thanks in advance.
You can't override shortcodes.php because the child theme replace only template files
But you can create a new file, like custom_shortcodes.php with your custom shortcode, save in your child theme and then include it in functions.php ( include 'custom_shortcodes.php'; )

Wordpress, Gantry Framework, Child Theme?

Does anyone have experience with Gantry Framework?
I am wondering if it is possible to create a child theme based off of the default? Where would I put my css file and can I build off of the current css instead of starting from scratch while still separating my css from the default theme?
Apart from the usual process of creating a WordPress child theme (create a directory, with proper style.css and functions.php), Gantry requires a specific procedure.
You'll need to copy two files from the parent directory to the child theme directory, keeping the structure:
/gantry/theme.yaml
and
/includes/theme.php
Then, edit the copied theme.yaml: the parent must be your parent theme directory name.
On the theme.php, select all text and replace with this:
// Initialize theme stream.
$gantry['platform']->set(
'streams.gantry-theme.prefixes',
array('' => array(
"gantry-themes://{$gantry['theme.name']}/custom",
"gantry-themes://{$gantry['theme.name']}",
"gantry-themes://{$gantry['theme.name']}/common",
"gantry-themes://{$gantry['theme.parent']}",
"gantry-themes://{$gantry['theme.parent']}/common"
))
);
As for css, you must create this file, within your child theme directory:
/custom/scss/custom.scss
It can be formatted in either SCSS or CSS, and will override the theme's core style sheet files.
Creating a Child Theme is very easy.
All you need to do is create a directory in your theme directory, and name it something like "Gantry-child". Inside that folder, add a file called "style.css". Once this is done, you just need to add the Theme Information that tells Wordpress the Child Theme's Name, Author, and Parent Theme.
Inside the new style.css, add:
/*
Theme Name: Gantry Child
Template: rt_gantry_wp
*/
The most important part that lets Wordpress know that this is a child of the Gantry Theme is the "Template" section. This is the name of the PARENT directory in your Themes folder.
What this will do is create a new theme that inherits all of the parent theme's functions. If you also want to inherit the existing parent theme stylesheet, add to style.css:
#import url("../rt_gantry_wp/style.css");
Hopefully this should get you started. Once that's done, you can add your own header, footer, index, functions, or anything else you can think of to extend the parent theme's functionality.
Hopefully this helps get you started.

Resources