Support » Fixing WordPress » php functions inside template

  • Resolved ebenezer357


    Hi everyone,
    Im coding in some php codes inside a template i’m building and i need to include a php inside another php but it gives me an error. This is what i have:

    if(qtrans_getLanguage()==’en’) {
    echo “<?php more_fields(‘Author’) ?>;”
    } else
    echo “Esta página esta en Español”;

    Apparently it doens’t let me include php functions inside another php. I tried to declare a variable with the result of <?php more_fields(‘Author’) ?>; but didn’t work either because in order to create a variable i need to have it inside a <?php right? or is there a way to declare variables without having to do them inside the <?php ??????

    Anybody please help me out!

    Thanks in advance for your help!

    Note: Im using qTranslate and MoreFields for Translation and Custom Fields.

Viewing 2 replies - 1 through 2 (of 2 total)
  • what is the exact error message?

    there is likely to be a semicolon missing at the end of the ‘echo’ line.

    generally, the echo function should be able to echo whatever you want, but it won’t execute the php code.

    I don’t know the more_fields() function (is that from a plugin?), but have you tried,

    echo more_fields('Author');



    Thank you alchymyth!!!
    more_fields(‘Author’); fixed my problem! Thanks a lot! 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘php functions inside template’ is closed to new replies.