Okay
  Public Ticket #154335
PHP in Child Theme
Closed

Comments

  • Erin started the conversation

    First of all, I love the theme!

    I recently created a Salient child theme since I was editing a few of the PHP files and didn't want to lose them after an update. The only issue I'm having is that files in the lower levels of the folder structure aren't being used.

    I was able to call the PHP file by adding the get_stylesheet_directory to functions.php, but I'm guessing I need to override the existing PHP using "if function_exists"...?

    Unfortunately I don't know a lot about PHP, but basically what I'm trying to do is replace the straight quotes on the testimonial slider with smart/curly quotes.

    I was able to get it to work when I edited the parent theme nectar/nectar-vc-addons/vc-templates/testimonial.php file (rather than the shortcode-processing.php file since I'm using the Visual Editor and not shortcodes) and changed it to be:

    extract(shortcode_atts(array("name" => '', "quote" => ''), $atts));
    	
    echo '<blockquote><p>&ldquo;'.$quote.'&rdquo;</p>'. '<span>&minus; '.$name.'</span></blockquote>';

    But when I call this child theme file, the home page just shows the double quotes and a minus sign on a white page.

    I'm just not exactly sure how to use the "if function_exists" command to replace things and what I would have to do to make it work correctly for the child theme. Any suggestions? And feel free to let me know if I'm doing anything wrong and if there is a faster/easier/better way to approach this.

    Thank you!!

    Erin

  • Erin replied

    I would also like to change the text of the "More Details" button when you hover over a portfolio thumbnail--we'd like it to say "More Photos" instead. I believe I've found the relevant PHP files and made the changes, but again it seems to be ignoring any files below the main child theme folder.

  •  997
    ThemeNectar replied

    Hey Erin!

    Some of the files are not capable in the current setup to be overwritten by a child theme (the ones that are directly included and not enqueued in particular). Even if these could be overwritten with a child theme, you'd still need to keep track of the updates because I will most likely still be adding to them/changing them over time and if your child theme was overwriting it, you would never see my changes in each new version.

    Hope that helps clear things up :)

  • MPdev replied

    I stumbled upon this issue as well. I understand that it is not possible to edit .php files at a lower level in the nectar folder. Could you please then modify the quotes in the testimonial.php file?

    echo \'<blockquote><p>\"\'.$quote.\'\"</p>\'. \'<span>− \'.$name.\'</span></blockquote>\';
    into:
    echo \'<blockquote><p>“\'.$quote.\'”</p>\'. \'<span>− \'.$name.\'</span></blockquote>\';

    (So:
    \" (dumbquotes)
    into
    “ ” (smartquotes).

    It’s just a typographical detail which is important especially in (graphic) designer portfolios!
    Thanks in advance.