How to get PHP into a WP pagebuilder

Has anyone here ever inputted PHP code directly into a Wordpress pagebuilder some how? I’ve been trying to some how input:

<?php date_default_timezone_set('GMT');
echo date('l, \\t\h\e jS \of F Y', strtotime('-2 weekdays')); ?>.

Any help appreciated.
Dez

Are you talking about the default classic editor or gutenberg block editor? Or are you talking about a specific plugin page builder like beaver builder?

If you are talking classic or gutenberg, no. And there is typically a reason for that, you are mixing content and logic. Can this be added with a filter instead? I mean, that is what filters are for.

If you are talking about a specific page builder plugin, then let us know which one.

As for other solutions, you can download plugins that allow you to then specifically add PHP code into a page or post (even though it is traditionally not advised). One such plugin is mentioned in this tutorial…

I hope that helps. :slight_smile:

Thanks, but didn’t want yet another plugin - already sorted yesterday. shortcode was the way.

I believe what you want is called a shortcode.
You will need to write the function yourself (preferably in the functions.php file), then register and hook the shortcode to your theme.

It’s really simpler than I made it sound tho. Added benefit, a shortcode is reusable and and can revive arguments.

here is a quick guide: Custom WP shortcodes

Thanks, but as already mentioned: