Question about Code Snippets plugin

This topic contains 8 replies, has 3 voices, and was last updated by  Paolo 7 years, 5 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #320257

    Nasiot Genís
    Buyer
    Post count: 26

    I’m trying to edit some functions with the Code Snippets plugin

    I have copied the function geodir_calender_event_details_after_post_title() (in the wp-content/plugins/geodir_event_manager//gdevents_template_functions.php file) and I pasted the code in a new snippet.

    When I active the snippet I get the error “Cannot redeclare geodir_calender_event_details_after_post_title()”.

    What I’m doing wrong? How can I edit a function?

    Thanks again

    #320544

    Kor
    Moderator
    Post count: 16516

    Hi Nasiot,

    That usually means you’ve inserted an invalid code. Could you tell me which code are you trying to implement and also share WP temp admin access to your site so we can take a better look? You can post the details here using the private reply option below.

    Thanks!

    #320737

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    you can’t modify every function that way. Only pluggable functions can be modified without changing the name function and pluggable function all start with

    if( ! function_exists('function_name') ) {// code here}

    see https://codex.wordpress.org/Pluggable_Functions

    In this case you are trying to modify a function that can’t be modified using that method. You should copy the function, rename it, find where it is used and make the plugin use your new function instead.

    Or use hooks to modify the function, but we need to know what you are trying to do to tell you if there are hooks for that.

    Let us know,

    Thanks

    #320945

    Nasiot Genís
    Buyer
    Post count: 26

    Hi Kor and Paolo,

    What I really want is not to show the time event in de listing event plugin. I tried it via CSS but I couldn’t do it. The only way I found was editing the gdevents_template_functions.php file.

    Now I’m afraid to loose all my code in the next plugin upgrade. There is another way to do it?

    Thanks for all

    #320951

    Paolo
    Site Admin
    Post count: 31206

    css was probably easier and yes you will lose your changes after every updates. Where exactly you want to hide the event time?

    I asked to the developers to let us know if there is a hook for this.They’ll let you know asap.

    Thanks

    #320958

    Nasiot Genís
    Buyer
    Post count: 26

    I’m using Supreme Directory. In GD Home Content Section I insert a GD > Event listing widget. In this widget appears the time that I want to hide.

    Thanks

    #320967

    Paolo
    Site Admin
    Post count: 31206
    #321626

    Nasiot Genís
    Buyer
    Post count: 26

    Hi Paolo,

    Thanks, it works!!!

    I’m sorry, I didn’t found this post before I asked.

    Congratulations for your plugin and for the support service

    #321628

    Paolo
    Site Admin
    Post count: 31206

    You are welcome 🙂

Viewing 9 posts - 1 through 9 (of 9 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket