Take your website
To the next level
Discover our newly launched customization services and elevate your web projects to new heights.
Delegate tasks, save time, and unlock the power of professional WordPress outsourcing.

Okay
  Public Ticket #2241324
overwrite function
Closed

Comments

  • paolotome started the conversation

    Hi,

    how can I overwrite wp-content/plugins/thegem-elements/inc/additional.php and use in child theme?

    thanks


  •  7,122
    Oliver replied

    Hi,

    What you need to change?

    Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list. 

    Regards, Oliver

  • paolotome replied

    I have modified this function "function thegem_attribute_post_title_with_date( $value, $data ) {}"  to dynamically add an icon to the list of articles depending on the category to which the article belongs

  •  7,122
    Oliver replied

    In your case you need to remove the filter:

    remove_filter( 'vc_gitem_template_attribute_post_title_with_date', 'thegem_attribute_post_title_with_date', 10, 2 );

    And then add your one in the child theme...

    Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list. 

    Regards, Oliver

  • paolotome replied

    OK thanks. In what position can I insert it into the child theme? 

    can't I overwrite additional.php file?

  •  7,122
    Oliver replied

    Hi,

    can't I overwrite additional.php file? -  no. it's not template.

     In what position can I insert it into the child theme?  - Sorry?

    Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list. 

    Regards, Oliver

  • paolotome replied

    sorry but I didn't understand where and how I can insert the modified function in the child theme

  •  7,122
    Oliver replied

    Code example:

    remove_filter( 'vc_gitem_template_attribute_post_title_with_date', 'thegem_attribute_post_title_with_date', 10, 2 );
    add_filter( 'vc_gitem_template_attribute_post_title_with_date', 'thegem_attribute_post_title_with_date_new', 10, 2 );
    function thegem_attribute_post_title_with_date_new( $value, $data ) {
        extract( array_merge( array(
            'post' => null,
            'data' => ''
        ), $data ) );
        return '<div class="post-title"><h4 class="entry-title"><a href="'.esc_url(get_permalink()).'" rel="bookmark">'.mysql2date('d M', $post->post_date).': <span class="light">'. get_the_title($post->ID) .'</span></a></h4></div>';
    }
    add_shortcode( 'gem_post_title_with_date', 'thegem_post_title_with_date' )

    Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list. 

    Regards, Oliver

  • paolotome replied

    thanks a lot. 

  •  7,122
    Oliver replied

    You're welcome!

    Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list. 

    Regards, Oliver