Tagged: , , ,

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #315055

    Hi,

    I would like to use php code in the extra header element ‘Phone Number or small info text’ for showing the date.
    <?php date_default_timezone_set(‘Europe/Amsterdam’); echo date(‘d-m-Y’); ?>

    But it does not seems to parse the code. How is it possible to achieve this?

    Love to hear from you,
    Julia

    #315117

    Hey hotspot!

    No, it doesn’t parse php at the moment and I’m not sure its a good idea to try and modify it to do that without adding additional security checks to the field.

    As an easy workaround you could try either creating a shortcode to output your php which the field should already parse (it uses do_shortcode) or using a plugin which lets you put php snippets into shortcodes.

    Cheers!
    Devin

    #317494

    I Devin,

    I used a plugin tho make php shortcodes.
    This works fine in the pages, but it does not work in the extra header element ‘Phone Number or small info text’.
    Any idea why this is not working in these fields and how we can solve this?

    #317806

    Hi!

    You’d need to enable shortcode rendering there, open /enfold/includes/helper-main-menu.php and look for this line:

    if($phone) 		{ echo "<div class='phone-info {$phone_class}'><span>{$phone}</span></div>"; }
    

    Replace it by this:

    if($phone) 		{ echo "<div class='phone-info {$phone_class}'><span>".do_shortcode($phone)."</span></div>"; }
    

    Best regards,
    Josue

    #317920

    Worked like a charm, thank you!

    #317922

    You are welcome, glad to help :)

    Regards,
    Josue

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Use of php code header or menu’ is closed to new replies.