• hamsterleg

    (@hamsterleg)


    Run a few WP sites, used some new developers for this one – they have added PHP into all pages, mostly to add images.

    For example:

    <img src=”<?php bloginfo(‘template_url’); ?>/images/facebook.png” alt=”” />

    As such we get lots of warnings that saving this article will render all contained PHP code permanently unuseful.

    Compared to me, they are supposedly the experts at WP, but that seems wrong to me?

    Any opinions greatly welcome.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Phil

    (@owendevelopment)

    Have they installed a plugin called Exec-PHP?

    This plugin does allow php to run in pages and posts and does also throw the warning up. It’s a workaround I guess, but I personally prefer to create a new page template with the php code already in – rather than adding it to posts. Means you have one less plugin running on the site too.

    Thread Starter hamsterleg

    (@hamsterleg)

    Yes they have installed Exec-PHP.

    For a lot of other sites, we just add the images via wordpress, have never seen this method used.

    Phil

    (@owendevelopment)

    It’s a lazy way of doing things:

    Why use php to get the path of /wp-content/themes/yourtheme/images/facebook.png when you can just type it like I just did?

    The more PHP calls and the more plugins your site is using will gradually slow your site down.

    Thread Starter hamsterleg

    (@hamsterleg)

    Thanks, lazy is exactly what I figured!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Adding raw PHP into pages – bad practice?’ is closed to new replies.