There are several examples on the net, however I use this:
<?php
//functions.php
add_filter( 'widget_text', 'php_parser', 100 );
function php_parser( $html ){
if( strpos( $html, "<"."?php" ) !== false ){
ob_start();
eval( "?".">".$html );
$html = ob_get_contents();
ob_end_clean();
}
return $html;
}
?>
Related Posts:
- Is there a way to set default custom fields when creating a post?
- Underscores in custom fields
- Add custom field to the archive page?
- Show only posts which can be commented OR have custom meta field
- Need small coding with Custom Fields Search
- Adding Custom Field to Taxonomy Input :Panel
- How do I make a custom field choose an image?
- get_post_meta() unserialize issue – returns boolean(false)
- How can I remove fields in the attachment editor?
- Unable to get Preview of Uploaded image within a Custom Meta box
- Edit Custom Database Tables in WordPress
- How to store the value of a custom field dropdown select for post referencing?
- Custom bulk action for media gallery items
- Change content before writing to database
- post meta data clearing on autosave
- WordPress Search Custom Meta Field Only
- Query Problem – Show posts within category ‘x’ that have a custom field between ‘y’ and ‘z’
- Localized Date Format for Custom Field
- Add description text under input field for new profile fields
- Which is best in the following scenario : post_meta vs custom table vs parent/child posts
- Saving custom image meta fields
- Echo values from custom field outside loop php
- How to add content at the end of posts?
- Transfer self made functions.php custom fields to Advanced Custom Fields [closed]
- Complex WP_User_Query call fails on production server
- Query post order by post and desc not working
- wordpress custom fields multiple data
- How do I define post titles as images using Custom Fields?
- How to show Small Box Inside Content Area, which holds (text, images, links)?
- Sort custom field by post
- How to create a gallery custom field for WordPress post?
- Get an advanced custom field after post publish
- Why the pagination for a query modified by pre_get_posts doesn’t mind the number & order of posts sorted & selected based on a custom date time field
- Trying to update_post_meta function
- How do i add custom fields to my themes template file?
- Custom Field to a Role?
- List users by sum of all their posts’ custom field values
- Duplicate (or more) custom fields on many posts. Is there an easy way to clean them up?
- Pull custom fields from custom posts within a loop
- Ordering posts by custom field named “date” in backend
- How to pass page as an argument like post in WordPress?
- How to display custom fields from a plugin
- Adding “meta” info to WP site PHP function?
- WordPress Media Uploader custom Javascript not working
- Custom fields issue [closed]
- Select custom posts by meta_value and sort by a different meta value
- List custom queried terms in the edit-tags.php?taxonomy page
- Front end register with custom fields
- Handling repeater data
- Display custom field from the front page on another page
- Enable a short code in the custom meta field
- Display custom widget value in header.php
- Gravity Forms Update post meta from template [closed]
- Automatic linking terms
- Adding extra fields to front end signup form
- Problem uploading different files as custom fields with front end post form
- How to change order of posts in admin
- Custom product fields in wp e-Commerce plugin [closed]
- wpdb function insert doesn’t work
- make a dropdown custom field with ‘cities’ list in it
- How can I modify my meta_query to work with prices that are stored in the database that contain dollar signs and commas?
- How to add extra field in admin comment section
- wordpress multi user question
- Get Custom Field Name ( Label or Key ) Not Value
- Custom field on Quick Edit using select/dropdown – almost working right but not showing currently selected value
- Type character in name and make it invisble
- How to set up page fields with gutenberg instead of ACF
- Adding Custom Metadata to my Archive/Posts page
- Move the post title to another field
- ACF multi taxonomy on filterable gallery
- Ordering by ACF custom field vaule
- Custom user registration fields in user_register hook
- Unable to change checkout placeholder text
- add different custom fields value to post class if permalink or index
- author.php not showing content if Author has no Posts
- Create Shortcode shows only posts with custom_field meta
- Custom Fields Not Working In Footer
- Login_form add to top of form rather then bottom
- Advanced Custom Fields from Category – IF statement
- Get a different meta value with ajax when different elements are clicked
- Delete custom fields on post publish?
- How do you turn a custom field’s value into a permalink for that post?
- Permalink structure depending on custom field
- Add custom field to post with some part of url as value
- How to add custom_fields value in JSON API using create_post
- CSS conditional on custom field value
- Using Hooks. Thematic
- WP Post Meta Box Field Not Showing Updated Field
- WP_Query based on multiple metadata comparisons
- same custom field for single posts
- Parse Shortcodes in Theme’s Custom Field?
- Alter SQL query to return posts with unique custom field value, no duplicate values
- custom field output after the_content
- Update field name without losing the value
- Post count by meta_key meta_value [closed]
- Change post status by custom fields
- How do delete a meta key?
- How can i put a custom field inside this php
- Conditional display based on ACF checkbox
- How to add an ACF only for parent term?