- This topic has 12 replies, 2 voices, and was last updated 10 years, 1 month ago by Theme Horse Support Team.
-
AuthorPosts
-
September 12, 2014 at 2:10 pm #15891grendizerMember
Hello, I need some help with setting up modified code in a CleanRetina Pro child theme.
Because of an incompatibility between the default slider and the Polylang plugin, I need to edit this file:
root folder/wp-content/themes/clean-retina-pro/library/structure/header-extensions.php
In this file I need to edit this function:
cleanretina_featured_post_slider()
And I add this line of code before the first IF loop:
delete_transient( ‘cleanretina_featured_post_slider’ );This was something I did each time I updated CleanRetina. However, now, following the advice of Theme Horse, I’m using a child theme.
This what I did so far:
– Updated CleanRetina Pro to v1.7
– Copied the original header-extensions.php to my hard drive and edited it.
– Created a folder clean-retina-pro-child with the style.css correctly set into it.
– Created this subfolders : clean-retina-pro-child/library/structure
– Inside this subfolder, I uploaded the header-extensions.php file.Unfortunately, what I did doesn’t seem to have any effect. It was working well on the “parent” theme, but does not seem to work on the child theme.
So my questions are:
1) Do I need to put this file into this subfolder, or in the clean-retina-pro-child folder (the root)?
2) Do I need to have the whole code of header-extensions.php in the child theme’s folder?
3) Is there another thing I’m doing wrong?Thanks,
David
September 15, 2014 at 6:29 am #16008Theme Horse Support TeamKeymasterHi grendizer,
you just create a functions.php on the clean retina pro (the root) and first unhook the functions and then only customise the code.
for more info
http://themeshaper.com/2009/05/25/action-hooks-wordpress-child-themes/
Thank you!
September 16, 2014 at 12:55 pm #16102grendizerMemberHello Theme Horse Support, thanks a lot for the help.
I’m reading this link and also this one : http://venutip.com/content/right-way-override-theme-functions
So I understood that for this to work, I need to find, in the original header-extensions.php , right before the begining of the cleanretina_featured_post_slider() function, a line that reads:
add_action(‘phase’,’function’, ‘priority’);
Unfortunately, I can’t find such a line before the begining of the cleanretina_featured_post_slider() function. Could you please help me?
Thanks,
DavidSeptember 17, 2014 at 5:13 am #16137Theme Horse Support TeamKeymasterhi grendizer,
I will set you a simple example. Not of this cleanretina_featured_post_slider() function but also helps you to create a child theme
for example:- (the below code is only the sample code)
unhook functions // Unhook default Thematic functions function unhook_thematic_functions() { // Don't forget the position number if the original function has one remove_action( 'cleanretina_404_content', 'cleanretina_display_404_page_content', 10 ); } add_action('init','unhook_thematic_functions'); // removes the header content by using hook cleanretina_header add_action( 'cleanretina_404_content', 'cleanretina_child_display_404_page_content', 10 ); /** * function to show the footer info, copyright information */ function cleanretina_child_display_404_page_content() { ?> <div id="content"> <header class="entry-header"> <h1 class="entry-title"><?php _e( 'Error 404-Page NOT Found', 'attitude' ); ?></a></h1> </header> <div class="entry-content clearfix" > <p>Thank you</p> </div><!-- .entry-content --> </div><!-- #content --> <?php }
September 17, 2014 at 6:51 am #16144grendizerMemberHi
Yes I was aware of this kind of code, and I’m about to add it to my child theme’s function.php, but there is missing information. For example, in your sample code, there is this line :
remove_action( ‘cleanretina_404_content’, ‘cleanretina_display_404_page_content’, 10 );
‘cleanretina_404_content’ : I must replace this by the real “phase”. Where do I find this info?
‘cleanretina_display_404_page_content’ : I must replace this by the real function: ‘cleanretina_featured_post_slider’
10 : I must replace this by the real position number. Where do I find this info?Thanks , and sorry for the newbie stance.
DavidSeptember 18, 2014 at 5:26 am #16208Theme Horse Support TeamKeymasterhi
This 404 functions is inside clean retina pro (themefolder) -> library -> functions -> functions.php on line no 472You may simply change it by creating header.php file inside child theme and first unhook the functions and then only customise the code. If you are not able to fix it then you may hire a developer to fix it.
Thank you!
September 18, 2014 at 9:50 am #16232grendizerMemberHi
Thanks for pointing me to the location of the function in your example code.Let’s look at the example code:
As I said in my September 16 post, just before the function, there should be a line with:
add_action(‘phase’,’function’, ‘priority’);
And indeed, just before the function cleanretina_display_404_page_content() , there is a line reading:
add_action( ‘cleanretina_404_content’, ‘cleanretina_display_404_page_content’, 10 );
This line is essential because it gives information to unhook the function.Now for the function cleanretina_featured_post_slider: it is located in:
clean retina pro (themefolder) -> library -> structure -> header-extensions.php on line no 490
Just before this function, there is NO line reading: add_action(‘phase’,’function’, ‘priority’);
So I don’t have the necessary information to unhook this function in the child theme.This should be easy to fix, thanks for any help!!
DavidSeptember 19, 2014 at 5:40 am #16279Theme Horse Support TeamKeymasterHi grendizer,
Yes exactly there is not add_action so you need code customisation to fix it.First you need to unhook this functions
add_action( 'cleanretina_header', 'cleanretina_headerdetails', 10 );
by and remove this action using
`remove_action(‘cleanretina_header’, ‘cleanretina_headerdetails’, 10 );}
add_action(‘init’,’unhook_thematic_functions’); // removes the header content by using hook cleanretina_headerNow whatever you need you need to add and where you need modification replace it or remove it and add your code
add_action( ‘cleanretina_header’, ‘cleanretina_child_headerdetails’, 10 );
/**
* Shows Header Part Content
*
* Shows the site logo, title, description, searchbar, social icons etc.
*/
function cleanretina_child_headerdetails() {// add your code under it .just only add the specific code you need. This will work for your header parts from social icons to slogan / slider.
}`
If you are still unable then you may hire a developer to fix it or better consult with a programmer.
Thank you!
September 22, 2014 at 2:40 pm #16436grendizerMemberWell I tried editing the code as best as I could but still can’t get it to work.
So now I should perhaps hire a devlopper but it would mean I would pay more for a bug fix. I’m just trying to fix a conflict between CleanRetina Pro and Polylang.
So how do I contact a developper and how much would it cost me?
ThanksSeptember 23, 2014 at 6:23 am #16464Theme Horse Support TeamKeymasterHi grendizer,
we actually does not work for customisation. We don’t have the exact idea how much the developer will cost it.
Thank you!September 23, 2014 at 7:50 am #16472grendizerMemberHowever I believe the bugfix for the conflict between CleanRetina and Polylang should be part of the CleanRetina code.
September 23, 2014 at 8:43 am #16473grendizerMemberHello again. So I have searched again by studying the functions and by reading articles on the web. I finally managed to do what i wanted. I’m putting here my conclusions to help other people with the same problem:
1) First, I noticed the function cleanretina_featured_post_slider() was OUTSIDE the function cleanretina_headerdetails(). There is a closing “}” before all bottom functions such as cleanretina_featured_post_slider(). As a result, in the child theme’s functions.php, there is NO need to refer to the function cleanretina_headerdetails().
2) Second, there are 2 ways to replace a parent function with a child fonction.
– First solution : Deactivate the Parent Function then Activate the Child Function: http://venutip.com/content/right-way-override-theme-functions . This is what I was trying to do.
– Second solution : use “pluggable” functions : http://codex.wordpress.org/Child_Themes#Using_functions.php : TIP FOR THEME DEVELOPERS. The fact that a child theme’s functions.php is loaded first means that you can make the user functions of your theme pluggable —that is, replaceable by a child theme— by declaring them conditionally. E.g.:
if ( ! function_exists( ‘theme_special_nav’ ) ) {
function theme_special_nav() {
// Do something.
}
}3) According to the code in header-extension.php, Theme Horse’s developpers are using the second solution for the function I’m interested in. The following line:
if ( ! function_exists( ‘cleanretina_featured_post_slider’ ) ) :
means that if the function cleanretina_featured_post_slider does not exist, then it should be run. But, the child theme’s functions.php is loaded before the parent theme’s functions. So if the same function already exists in the child theme, it will not run in the parent theme!4) So my code in the child theme’s functions.php is very simple:
<?php // Opening PHP tag – nothing should be before this, not even whitespace
function cleanretina_featured_post_slider() {
//original code pasted here , then modified for my own needs.5) It’s a lot of work and research for a simple bug, so I repeat: Theme Horse should fix once and for good the conflict between CleanRetina (Free & Pro) and the Polylang plugin.
Thanks
DavidSeptember 24, 2014 at 12:00 pm #16549Theme Horse Support TeamKeymasterThanks a lot for sharing your experience with us
Thank you!
-
AuthorPosts
- You must be logged in to reply to this topic.