Retain changes after updating plugin
This topic contains 3 replies, has 2 voices, and was last updated by Guust 10 years, 1 month ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
March 13, 2015 at 11:00 pm #33996
Hello,
I have made several changes to these files: custom_fields_functions.php and post_functions.php.
How do I avoid losing my changes when updating the plugin / my theme to a newer version?Thanks!
Geert
March 13, 2015 at 11:10 pm #33997Hi Geert
Best practice is to never change plugin files, but to replace functions etc in your child theme’s functions.php.
So it all depends a bit on the changes you made; was there no other way than modifying core files?
Without knowing what changes you made and why, it is not possible to comment on other options.
If you want to keep the changes in the plugin files, then back them up before upgrading, then compare the new with the old and modify to suit. But really not the best idea.March 13, 2015 at 11:32 pm #34000Hi Guust,
Thanks for the quick reply 🙂
In custom_fields_functions.php I changed the following:
– To customize the information displayed in the INFO tab in detail view:
`if($post->post_address){ $html .= ‘<span itemprop=”streetAddress”>’.$post->post_address.'</span>,<br>’;}
if($post->post_zip){ $html .= ‘<span itemprop=”postalCode”>’.$post->post_zip.'</span> ‘;}
if($post->post_city){ $html .= ‘<span itemprop=”addressLocality”>’.$post->post_city.'</span>,<br>’;}
if($post->post_region){ $html .= ‘<span itemprop=”addressRegion”>’.$post->post_region.'</span>,<br>’;}
if($post->post_country){ $html .= ‘<span itemprop=”addressCountry”>’.__( $post->post_country, GEODIRECTORY_TEXTDOMAIN ).'</span><br>’;}
$html .= ‘</div>’;
}`– Added a <BR> to this line:
$html .= (trim($type['site_title'])) ? __($type['site_title'],GEODIRECTORY_TEXTDOMAIN).': <br>' : '';
In post_functions.php I changed:
– Address layout on homepage map preview:
$address = str_replace($srcharr,$replarr,htmlentities(geodir_get_post_meta($ID,'post_address',true), ENT_COMPAT, 'UTF-8')) . ', <br>' . str_replace($srcharr,$replarr,htmlentities(geodir_get_post_meta($ID,'post_zip',true), ENT_COMPAT, 'UTF-8')). ' ' . str_replace($srcharr,$replarr,htmlentities(geodir_get_post_meta($ID,'post_city',true), ENT_COMPAT, 'UTF-8')) . ', <br>' . str_replace($srcharr,$replarr,htmlentities(geodir_get_post_meta($ID,'post_region',true), ENT_COMPAT, 'UTF-8')) . ', <br>' . str_replace($srcharr,$replarr,htmlentities(geodir_get_post_meta($ID,'post_country',true), ENT_COMPAT, 'UTF-8'));
– Changed code to display website instead of phone number on the homepage map preview:
if (geodir_get_post_meta($ID,'geodir_website',true)) { $contact = '<a href="' . geodir_get_post_meta($ID,'geodir_website',true) . '" target="_blank">' . str_replace($srcharr,$replarr,htmlentities(geodir_get_post_meta($ID,'geodir_website',true), ENT_COMPAT, 'UTF-8')) . '</a>';
– Changed the Font-Awesome icons that are used:
<div class="geodir-bubble-meta-side"> <span class="geodir_address"><i class="fa fa-map-marker"></i> <?php echo $address;?></span> <?php if($contact){?><span class="geodir_contact"><i class="fa fa-link"></i> <?php echo $contact;?></span><?php }?> <?php if($timing){?><span class="geodir_timing"><i class="fa fa-clock-o"></i> <?php echo $timing;?></span><?php }?> </div>
I don’t think I can do these changes elsewhere / in another way?
And how should I do it, putting the functions.php in the child theme?Thanks!
Geert
March 13, 2015 at 11:53 pm #34004I cannot directly see any changes you made that cannot be made in GD settings, or style.css.
The majority of your changes can be achieved with CSS or changing custom field settings.http://codex.wordpress.org/Child_Themes#Using_functions.php
For example, to add address to the INFO tab:http://docs.wpgeodirectory.com/core-place-settings/#custom
To change the address display:
https://wpgeodirectory.com/support/topic/dutch-adres-syntax/#post-23683
https://wpgeodirectory.com/support/topic/change-display-order-of-field/ -
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket