• Sorry if this isn’t the correct forum….please feel free to recategorise!!

    —————————–

    Good Evening

    Before I get stick into configuring WP I have a few question about where to put some PHP code.

    I’ve created a custom plugin which carries out some functions. “Front End” PHP code (including some HTML) has been inserted directly into each page via the WP dashboard with the use of a plugin Exec-PHP.

    Using this method of inserting the PHP means that only the visual editor can be used to add content to the page.

    I’ve copied the “full width” template to create a new template and copied the PHP code. The WP page then uses template, each page will require its own template.

    Is this the best method to add Front End PHP code into a page, or is there a more flexible method?

    Thank for your help.

    Ben

Viewing 3 replies - 1 through 3 (of 3 total)
  • Not sure if im on the same page as you on this one, but you could put the code into your themes functions.php and create a function for the code:

    function my_function_name() {
    }

    Then call in the php code using
    <?php my_function_name(); ?>

    Then you just need to update your functions.php to update across the whole site.

    Thread Starter bsandall

    (@bsandall)

    Damian

    Thank you for your reply.

    How would I call the function? would this be in the template file?

    Thanks

    Ben

    <?php my_function_name(); ?>

    Would be used to call the php function in to any wordpress page you wanted.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Best place for "Front End" PHP’ is closed to new replies.