• Hello, I’ve been Trying to override the template code and some other files like the giveasap-template-functions.php File I’ve added the file in my child theme and even created the same plugin folder giveasap and added the file nothing seem to work. Is there a way I can override the template?

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Igor Benic

    (@ibenic)

    Hi @alijafark, I’ll see to enable that in the next update for now. Try this:

    add_filter( 'giveasap_display_template_path', 'change_path_to_template_in_child_theme'

    then inside of that function:

    function change_path_to_template_in_child_theme() {
     return trailingslashit( get_stylesheet_directory() ) . 'giveasap/';
    }

    Then inside of giveasap folder add template1.php file

    Plugin Author Igor Benic

    (@ibenic)

    Also, I forgot I added this. You can create a folder giveaways and copy the structure there. For example, copy the giveasap_template.php and templates/template1.php and it should work out of the box

    Thread Starter alijafark

    (@alijafark)

    I’ve created a Folder In my child theme with the structure /giveaways/includes and added the file giveasap-template-functions.php and I also created another structure public/templates/template1.php In my giveaways Folder. it didn’t seem to override the Template. I also did restructure the path to templates/template1.php as you wrote it didn’t work either. and

    dd_filter( 'giveasap_display_template_path', 'change_path_to_template_in_child_theme'

    The First solution giveasap_display_template_path Didn’t work too

    Plugin Author Igor Benic

    (@ibenic)

    @alijafark inside of your child theme it should be giveaways/giveasap_template.php and giveaways/templates/template1.php

    Thread Starter alijafark

    (@alijafark)

    @ibenic Here is a screenshot of how I structured it as you explained. The Templates are not getting overridden.

    Thank you.

    Plugin Author Igor Benic

    (@ibenic)

    You’re close ?? Delete the other files as they won’t help you. Just leave the templates folder and the template1.php in it.

    No create the giveasap_template.php file inside of /giveaways/ and then copy the contents of wp-plugins/giveasap/public/giveasap_template.php

    You can delete the previous code involving giveasap_display_template_path.

    Thread Starter alijafark

    (@alijafark)

    Previous code has already been deleted those files are the files I’m trying to override I’ve deleted them too to test if giveasap_template.php works unfortunately there isn’t any success. Thanks

    Plugin Author Igor Benic

    (@ibenic)

    Hi @alijafark, I have tried it myself and everything seems to work.

    Here is the structure of a child theme: https://paste.pics/84f0a5d325a89b7abbb94e6d441fde6b

    (Both giveasap_template.php and template1.php have exact same code as the original ones).

    And here if I change something inside of files in child theme, it reflects on the giveaway: https://paste.pics/72a69b52a18241605a0bae2849b65b4a

    Thread Starter alijafark

    (@alijafark)

    Doesn’t seem to work for me But Thank you @ibenic I’ll try figuring another way that works for me or why it isn’t. everything you said was done correctly on my side.

    Thank you so much.

    Hi any progress about this topic? I also tried but no luck.
    https://paste.pics/BB4BY
    https://paste.pics/BB4BF
    https://paste.pics/BB4BO

    • This reply was modified 3 years, 10 months ago by wadeshow25.

    I got it now. Thank you so much.
    https://paste.pics/BB7CV
    https://paste.pics/BB7D4

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘How To override The Plugin Template code’ is closed to new replies.