I know this question might sound generic, but the answers to those generic questions is not working for me.
I am very new to touching wordpress php files, and I am working for a client using the FitPro theme (I will be posting on their general forum but my client no longer has support :/). I need to change the permalink for the cutom post type defined as "fitness-class" and replace it with "classes".
I found where the slug is defined (it is in a file called custom_post_types.php and it is located at 'framework/presentation/custom_post_types.php'). I confirmed that changing the file of the parent theme achieves the desired affect, however it does not work when I try to replicate it in the child theme.
I copied the custom_post_types.php file to my root directory in the child theme, made the change and it did not work. I replicated the file path of the parent theme and it still did not work. I looked up the problem online and, among others, came across this solution : https://wordpress.org/support/topic/child-theme-fix-use-get_template_part-instead-include-get_template_directory.
My Problem (at least right now): My theme does not appear to have a front-page.php file. Instead there is a file at 'framework/framework.php' that includes the following line: require_once(MO_FRAMEWORK_DIR . '/presentation/custom-post-types.php');
How do I go about over-riding this specifically? There is no get_template_directory call for me to over-ride as far as I can tell as the above solution stated.
I tried commenting out the line and then copying the framework.php file to both my child theme root directory and I tried copying the parent theme file path. I tried adding the get_template_part call to both my functions.php file and the framework.php file. I do apologize if I am clueless here, but I have not yet gotten to the point of learning the wordpress structure.
Any advice is greatly appreciated thank you. I have no idea where MO_FRAMEWORK_DIR is defined, but if I do find it and it solves my problem I will update the question.
Whatever file you have to override from the parent theme then you have to copy this file and you have to put simply in the child theme
For Example if u have to override single.php file of the parent theme. Then you can simply copy the single.php file and put it to child theme.
Create folder in you child theme as below.
framework/presentation/
And under the presentation folder put the custom_post_types.php
I hope you understand.
Related
I have added two custom written functions to my wordpress code.
One of them uses the add_action() and the other uses the add_filter() function of wordpress.
After deploying the code, both functions work as expected, but after some time (I am not sure how long it takes and what causes wordpress to do so) the code just magically disappears from the file.
I am now wondering
Why is this happening?
What can I do so that this won't happen again?
Thanks for your help
Hey you just mentioned that you've added code into /wp-includes/functions.php file. You've used action and filters that's good but your code should be go into active theme's (child theme is the best practice) functions.php file. Files under /wp-admin/ and /wp-includes/ get updated automatically from WP when new update is available (based on settings you have done on your WP setup you can ignore updates as well).
So, your code must be removed by update. Files were overridden by updates. If you have backup copy those code and put it into active theme's functions.php file /wp-content/themes/yourtheme/functions.php is the correct file where you can add the code.
If you have added code into theme's functions.php file make sure you didn't get theme updated otherwise you may lost your work as well that's the reason you can use the Child theme. You can learn how to create child theme here: https://developer.wordpress.org/themes/advanced-topics/child-themes/
Why is this happening?
Most probably because someone updated WordPress to latest version. Before you are going to tell me "but I did not press anything, ever!" please bear in mind, that WordPress updates itself automatically. Especially in the newer versions.
Here is nice article about WordPress automatic updates. It also describes how to turn this off, but I do not recommend doing so.
What can I do so that this won't happen again?
Develop custom WordPress plugin, containing your customizations. Here is nice step by step tutorial
you shouldn't make any changes into wp-includes and wp-admin folders, these folders will update automatically if your wordpress is updated. so if you want to make any changes using hooks and actions you can place the code into your current theme's functions.php. that will work as expected and your code won't disappear.
I'm making a web with a Wordpress and modifying some things with a child and css theme. The problem is that the theme uses a folder with the name "Wp-less-Cache" and inside it introduces a "theme-less.css" that it generates automatically. The problem is that now when I try to modify something by css the my mytheme.css (in the child) does not leave me because it tells me that what I want to retouch belongs to the file "theme-less.css" .... and if I tweak the CSS directly in that, it works but when this file is generated again automatically after a while it deletes the modifications that I had made in it.
I would like to know:
Can you disable the wp-less-cache? it is not in my list of plugins or among the plugin folders ...
Can I do something so that my modifications of the child theme are effective if he is active?
Thank you very much
It is used by one plugin called tlg_framework which is a built in plugin with themes that developed by http://www.themelogi.com/
I'm by no means a coder or programmer but i have enough to understand my part and fix small issues or adjust look with basic CSS, and so friend of mine asked me for help and here i am two days later asking you)
There is a Website running Enfold theme which recently were updated and so was lost custom image link at right part of header made by someone-else.
I have restored link code from Cached version of website but have no real understanding how and where to add it back to theme templates. Would appreciate any help, solution, link, advice.
Cheers.
A wild guess, since I don't have Enfold theme (the best would be to ask on the official support), but in your div #header_main in the .inner-container, you had after the #advanced_menu_toggle this piece of code:
<img src="http://vcmt.ca/wp-content/themes/enfold/images/layout/canvas.jpg" alt="canvas" style="max-height:70px;">
Just open the .php file that has the header in it, and paste this code back in. Since the canvas.jpg was located in the /images folder of the theme, that is also gone, so my recommendation is to download the image from the cached version if you can and put it back in the image folder.
Also it would be better to make changes to child theme, so that you can update the functionality of the theme, without loosing any custom added modification, like this site had.
If you're planning on changing the CSS in any WordPress Theme, you want to make sure that you have a child theme installed. The child theme allows you to change/overwrite the CSS and Theme Functions on the theme without losing those changes everytime the theme updates.
You can download the Enfold Child Theme Here:
https://kriesi.at/documentation/enfold/how-to-install-enfold-theme/#why-child-theme
...and if you need to add HTML to the header, you can do so by duplicating the header file from the theme, adding a header file to the child theme, and making your changes in the child theme header file.
Hope this Helps!
I am trying to achieve the basic function of using a custom header on my home page in Wordpress.
I am only just learning wordpress but I will try and explain.
So I have both a parent and child theme, the parent theme has a folder called 'inc' with a file custom-header.php ready to tailor.
I have duplicated the 'inc' folder and placed it in my child theme folder.
At the top of page.php file in the parent folder (there is no duplicate in the child folder) I have changed
get_header(); ?>
to
get_header(custom-header); ?>
I have tried making dramatic changes in both the Parent custom-header.php and the duplicate child custom-header.php and nothing happens.
I have also tried changing the file names, for example header-home.php and then calling
get_header("home"); ?>
and this does not work either.
I have put the get_header in the top of the page.php as I think this is where it is served from (with my limited knowledge) and when I try and edit it, the page fails to reload, so I would assume it is the right php file but I am obviously doing something wrong. I have spent quite some time looking but it is suprisingly difficult to get a clear, concise explanation on the right syntax and exactly where I place the get_header code and actually keep the custom header file.
Any help would be great.
The only correct versions you used was:
//file: header-home.php
get_header('home');
Unfortunately for header files, they need to be in the root directory of your active theme (or parent theme if using a child) to be called. i.e. themes/custom-theme/header-home.php
You are correct as in you change the get_header() function in your page files, but dont forget your home page may be front-page.php, home.php, index.php or a page-whatever.php if using a wp page as the front page.
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.