• I am trying to list the code in my child theme’s functions.php file on a WordPress page. I have copied it to a folder (PDC/code) and put the following into my page via the Tag editor:
    <pre class="lang:php decode:true " title="PDC full" data-url="PDC/code/functions.php" ></pre>
    The result is a 7 line display which includes reference to an undefined function add_action() on line 10 – which is there.

    <br />
    <font size='1'><table class='xdebug-error xe-fatal-error' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
    <tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Fatal error: Call to undefined function add_action() in C:\wamp\www\PDC\code\functions.php on line <i>10</i></th></tr>
    <tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
    <tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
    <tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0006</td><td bgcolor='#eeeeec' align='right'>157208</td><td bgcolor='#eeeeec'>{main}(  )</td><td title='C:\wamp\www\PDC\code\functions.php' bgcolor='#eeeeec'>..\functions.php<b>:</b>0</td></tr>
    </table></font>

    So I then created a functionsA.php file with just one php function and no add_action() and put the following into my page:
    <pre class="lang:php decode:true " title="PDC 1 function" data-url="PDC/code/functionsA.php" ></pre>

    The result is a 1 line blank display, but seemingly no error.

    It seems as though Crayon is reading the files but is trying to execute them rather than just list them out. I am using the suffusion theme, Crayon Version 2.7.1, and a number of plugins. Disabling some of the other plugins that I thought might be affecting things has not changed anything.

    What am I doing wrong? Sorry I cannot show a link as all this is happening on my WAMP.
    Thanks

    https://www.ads-software.com/plugins/crayon-syntax-highlighter/

  • The topic ‘What am I doing wrong – using data-url?’ is closed to new replies.