Template Files missing in wordpress theme folder - php

Im using tyche theme for e-commerce.i have created template files for pages.like profile creating page.
Template file:
<?php
/*
Template Name: Create Profile
*/
when i assign this template for a wordpress page.Its working fine. but two or three days later that template files are missing from my theme folder. What i have to do Now. Please help me.
Thanks...

This is because when theme get updated all custom codes created by user, which resides in template folder, get replaced. So it is better to create a child theme and use it.
If you modify a theme directly and it is updated, then your
modifications may be lost. By using a child theme you will ensure that
your modifications are preserved
More here

Related

Add a custom-made slideshow to Wordpress Theme

So i made a slideshow using HTML, CSS and JS.
It's for a personal blog i'm creating, so i would like to add the slideshow into a Wordpress theme that i purchased.
I created a child theme and tried to edit the function.php file and the style.css, and although i know some PHP it's really hard to understand how the code works and where to add mine.
Basically i want to display my slideshow initially, and then the rest of the Wordpress theme with all the posts and such.
Is it possible or should i only work with the customization options of the theme, although they're limited?
Since you've gone with a child theme, may I suggest copying a page template from the parent into your child theme?
Then you can copy your code for the slideshow via the editor into your child theme's copy of page template and use said template throughout your website for whatever page you'd like without colliding with parent theme updates.
Here's a relatively simple tutorial for creating a page template:
https://www.cssigniter.com/add-custom-page-template-using-child-theme/

Codeigniter view in Wordpress

I have a website build with Codeigniter and I need to have a blog. It should be a WordPress so what I decided to do is to add "blog" in my .htaccess and install a WordPress in myweb.com/blog
It works perfect.
Now, I need to change my theme header and footer from the one that I have already in my web.
How can I do it?
I have the view at views/common/header.php, but obviously, I can not load it like this in template/header.php
<?php $this->load->view('common/header');?>
If I'm not wrong, I should add any code at header.php in my template folder. So, the question is, what should I change or add on it??
Thanks a lot!
UPDATE
I think there should be a helper I could load in codeigniter in order to call that functions on Wordpress
How can I do it?
You directly cannot call CI view in wordpress file. Inorder to make changes to wordpress header and footer you will need to modify header.php and footer.php file under wordpress theme (wp-content/themes/your_theme_folder).
Also make sure that you do not modify wordpress default theme directly as any changes to default theme would be lost during wordpress updates.
Best practice is to create child theme and then make your changes over there
https://codex.wordpress.org/Child_Themes , here the guide to create child theme.

Need to include a custom template page through a plugin

is there any way to include a custom template from a folder inside my plugin page into the Wordpress system so that when I, for example create a new page/post, it can show as one of the template choices other than default of course.
I have seen this link here WP - Use file in plugin directory as custom Page Template? but does not seem to talk about the stage were Wordpress checks for custom templates in the themes directory and how to make it look else where.
It's not in the documentation because WordPress doesn't look elsewhere. Your best bet would be to create a template page in your theme folder, call it what you want, and then use include() to pull the contents of your template file in the plugins directory into the file in your theme directory, which would allow WordPress to see it.
I think the only other way to accomplish this would be to mess with Core, which is very bad practice.

where to find the origing category.php file in wordpress?

Hi I'm new to wordpress I have been working on a theme I would like to have the original category.php file that needs to get added on the theme? I have tried to copy a category.php file from a theme that was created on the core of wordpress but the body is missing, where can I find the original category.php file template that will be used by wordpress when it is not being defined on my theme?
version: wordpress 3.5.1
As templates are going to have theme specific markup, you'll need to make revisions to any file that you plan on copying over if you want the page to work with your theme.
A simpler solution is to copy your page.php file and replace your post loop with that of the categories loop. This will allow you to easily maintain your site's design without having to rework any markup and can be accomplished pretty quickly by copy/pasting a category loop snippet.
A great starting place to see how these loops are structured is the WP twentytwelve theme found here: http://wordpress.org/extend/themes/twentytwelve
Much greater documentation can also be found in the codex here: http://codex.wordpress.org/Category_Templates
Template files are stored in:
/wp-content/themes/<theme_name>/
You can copy the category template from a theme, but then it wouldn't look like it's a part of your theme though and might be badly styled because of missing CSS rules.

Should I use a wordpress hook to replace a file?

I'm having a little trouble deciding how I should be implementing hooks in wordpress.
I'm currently using a child theme and in the single.php file of the parent theme there is a function <?php con_get_sharebox(); ?> that gets the contents of a file sharebox.php.
Now the sharebox.php file is the file I'd like to edit but I don't know how to do this using hooks.
I tried simply adding a different sharebox.php to my child theme but because its not part of the standard theme files I don't think it gets loaded.
Any ideas on what I can do?

Categories