• Can someone recommend a current (and up to date) plugin that’ll allow me to embed functioning PHP in pages and posts?

    I’m currently using PHP Execution, but have been having trouble with the code randomly not working. Unfortunetly PHP isn’t my strong suit, but from what I can tell my code itself is correct, so I suspect that the out of date plugin is the problem.

    Did a quick search looking at plugins, and it looks like there’s several, but the ones most commonly recommended are out of date by 2 or more years. Can someone recommend any of the current ones?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Ruth, the one I’ve used is https://www.ads-software.com/plugins/shortcode-exec-php/ and haven’t had a problem but might I also suggest you consider running the PHP as a shortcode instead of executing PHP in your pages?

    https://codex.www.ads-software.com/Shortcode_API

    I find it a lot more secure, as well the ability to update PHP in the functions.php file gives me much more control.

    Thread Starter ruthcatrin

    (@ruthcatrin)

    I will look at it, thanks!

    Thread Starter ruthcatrin

    (@ruthcatrin)

    Ok, not entirely sure I get shortcodes, but using the plugin, I create a list of the various php coding I want to use, give them a name, and then use those names place them within the page?

    Hi Ruth, so a shortcode is a small piece of executable PHP stored in a function that can be called from the WordPress editor.

    For example, I have a small shortcode at https://thisismyurl.com/7611/adding-sitename-shortcode/ that will allow you to display the name of your website without having to edit the text each time. I use it on client websites for Terms of Service and Privacy Policy pages where the content is duplicated from other sites but the name of the site needs to be replaced.

    In the editor, it appears in the text as “while visiting the [sitename] website” but appears to visitors as “while visiting the ABC Company website”.

    You’ll see the function is actually very simple.

    function thisismyurl_shortcodes_sitename() {
      return '<a href="' . get_bloginfo( 'url' ) . '" title="' . get_bloginfo( 'sitename' ) . '">' . get_bloginfo( 'name' ) . '</a>';
    
    }
    add_shortcode( 'sitename', 'thisismyurl_shortcodes_sitename' );

    I add a new short called ‘sitename’ which executes the function thisismyurl_shortcodes_sitename. That function returns the HTML needed to display the link and name of the site to site visitors.

    I think this is a much safer method than allowing PHP to be executed directly from the text editor.

    Thread Starter ruthcatrin

    (@ruthcatrin)

    Alright, I’m going to have to look at this later when I’m not feeling quite so fuzzy, cause right now my brain in insisting none of it makes sense, but I’m pretty sure thats me not you…..

    Part of the problem I’ll admit is that my PHP skills (or lack there-of) is entirely self taught……

    I also have the feeling that if I just keep poking at the various plugins one of them will do what I want without me having to do coding, but I’ve not had any luck there either. Lots are close, but nothing seems to be quite there.

    What I’ve done is create this page: https://www.scaryyankeechick.com/rss-feed/ using PHP to check each site on the list, and post a link to the site and the name of their most current post.

    Thread Starter ruthcatrin

    (@ruthcatrin)

    Alright, re-read it all. I like the concept, but I don’t think shortcodes are going to work for what I want to do. I guess I’ll keep plugging away at it.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Plugin to support embeding PHP’ is closed to new replies.