• How to setup override templates? I have child theme, in folder of this theme I created a folder with name wpadverts/templates

    Also I created a plugin override-templates.php and activated him, how to configure it, what I have to write in 1. $dirs[] = $upload_dir["basedir"] . "/wpadverts/";

    I want to take files from wp-content/plugins/wpadverts/templates and put in my directory wp-content/themes/mytheme/wpadverts/templates and change these files.

    Also I want to change some css files, the same take them from official plugin directory and copy them to my folder, for example wp-content/themes/mytheme/wpadverts/templates/css

    How to do it and configure correctly?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    1. if you installed the override-templates.php correctly, then you just need to copy the files you want to change from wp-content/plugins/wpadverts/templates/ to wp-content/themes/mytheme/wpadverts/ (not wp-content/themes/mytheme/wpadverts/templates/).

    2. to make CSS changes it is best to go to wp-admin / Appearance / Customize / Additional CSS panel and apply there changes which will override the default WPAdverts rules.

    Hello Greg,
    I have installed override-templates.php, copied the files, now I have the files in the folder …/themes/astra/wpadverts/ but the page https://www.mysite.it/adverts doesn’t change, I continue to see the adverts with your theme and not my Astra theme.
    What I do wrong?
    Thanks in advance

    • This reply was modified 4 years, 11 months ago by LucaVT.
    • This reply was modified 4 years, 11 months ago by LucaVT.
    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    do you have the templates modified somehow or just copied?

    Also, an actual link to your website could be helpful.

    Just copied
    https://www.napoliannunci.it here I have used the php function to add the adverts to the loop
    https://www.napoliannunci.it\adverts here your page
    Thanks a lot.

    Plugin Author Greg Winiarski

    (@gwin)

    Just copying the files will not change anything in the layout, after copying the files you need to customize them to your needs.

    Oh Okey I will try. Thank you

    Thread Starter Sergey

    (@sergey561)

    Hello Greg.
    When I copy a file from wp-content/plugins/wpadverts/templates/ to wp-content/themes/mytheme/wpadverts/ no changes.

    What I need? I want to put files to wp-content/themes/mytheme/wpadverts/ which will load styles from my directory, for example from wp-content/themes/mytheme/wpadverts/css or wp-content/themes/mytheme

    I want to make my child directory for your plugin like a child theme.

    • This reply was modified 4 years, 11 months ago by Sergey.
    • This reply was modified 4 years, 11 months ago by Sergey.
    • This reply was modified 4 years, 11 months ago by Sergey.
    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    1. do you have the override templates snippet (https://raw.githubusercontent.com/simpliko/wpadverts-snippets/master/override-templates/override-templates.php) installed and activated?

    If not then uploading the files will not do anything.

    2. the child templates work only for the files in wpadverts/templates/ folder, it will not work for JS or CSS files.

    Thread Starter Sergey

    (@sergey561)

    Hi, yes I upload and activated this plugin https://raw.githubusercontent.com/simpliko/wpadverts-snippets/master/override-templates/override-templates.php

    But, what I have to write here? $dirs[] = $upload_dir["basedir"] . "/wpadverts/";

    /wpadverts/ or /mytheme/wpadverts/ or fullpath?

    My current theme is a child of twentytwenty.

    • This reply was modified 4 years, 11 months ago by Sergey.
    • This reply was modified 4 years, 11 months ago by Sergey.
    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    you should leave it as is, this line will detect your current theme and will set the path to /wp-content/themes/{your-theme-name}/wpadverts/

    So i understand you have the override templates working and the files uploaded to /wp-content/themes/{your-theme-name}/wpadverts/, if you make a change in a file for example /wp-content/themes/{your-theme-name}/wpadverts/list.php do you see this change on page with [adverts_list] shortcode?

    Thread Starter Sergey

    (@sergey561)

    Hi, I make a changes in single.php, but doesn’t work. When I make a changes in your folder wp-content/plugins/wpadverts/templates/ it’s working.

    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    ok, it seems the files are not being pulled but it is hard to tell why.

    I would start debugging with adding below function override_templates( $tpl ) { the line echo "OK.";, then refresh the page and see if “OK.” shows somewhere on the page.

    If it does then it means the loading custom templates works (and you can remove the line echo "OK.";), if it doesn’t then it means it does not work, this might be because the code is not executed for some reason.

    If the “OK” shows then it would best if you could post here a screenshot from your FTP program so i could see the full path and where you have the files uploaded?

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Override templates’ is closed to new replies.