By default, PHP is stripped out of the posts content. You can use this plugin to aleivate this:
http://wordpress.org/extend/plugins/exec-php/
This will give you a quick, easy fix to be able to do it the way you are trying to. I would suggest reading http://codex.wordpress.org/Custom_Fields for the more proper way to do this though.
Related Posts:
- Putting PHP variables into javascript [duplicate]
- Integrating PHP into Javascript to display map markers with Google API
- Run a Parallel PHP Application with WordPress
- Pass PHP variable to JavaScript without inline JS
- Integrating PHP into Javascript to display map markers with Google API – problem with wp_localize
- PHP array to JS array to use in google map
- How to reference PHP in Javascript
- Unable to display multiple parameters from url by javascript through shortcodes
- Trying to add some custom text into WordPress Post title via function.php
- Filtering markers on google map by WordPress category[SOLVED]
- Generate a radius search of custom post type locations
- Querying latitude and longitude into google maps correctly
- Import and use a variable in additional settings of Contact Form 7 [closed]
- How can i add a script with parameters?
- Run do_shortcode on php template using JS function
- global $product is empty string when passed into function
- Gutenberg block don’t save rich text content
- Can’t pass var from php wp_ajax into ajax script : result undefined or null
- Using Google Analytics in an enqueued JS file
- Creating a POP Alert
- Create a WordPress Contact Form to call a POST AWS API Gateway and send user data
- Admin-ajax.php 404 error
- How can i find wrong word in search box and replace with correct word
- How to pass values from one function to the other using an array variable
- Custom global variable not working in function
- separate list of programs in html/javascript coming from php
- How do I integrate vanilla Javascript to a wordpress website?
- WordPress How do I pass a variable from one add_action to another?
- How to use wp_ajax_set_post_thumbnail?
- Best way to use variables in multiple functions?
- Passing a value from an input field to a php function in WordPress?
- Hide Approved status for certain users in users list
- How do I disable cache for a certain page?
- How To Get HTML Eelement From Another Page
- Ajax search box displays nothing if taxonomy doesn’t exist
- Display one random image from Media Library
- Conditional Banners
- Reduce Stock Based on Custom Variation Field Rather than Attribute (Working Script)
- ACF values to Script with auto refresh
- Update $wpdb query with AJAX
- Google CSE Malfunctions via Chrome/Safari on Mobile When Clicking on Either Search Icon/Menu Icon. How to Make Google CSE Default Theme Search
- I have a lot of JavaScript erorrs after SSL someone can help me?
- $.ajax results in 403 forbidden
- WordPress Slider is not working
- How can i show specific Category List?
- Using Javascript On Page – Header and Footer Now Missing
- Store data from JavaScript object to custom table in user account
- How do I fix Undefined variable using $_POST in function?
- register dependency css and js inside a plugin class
- Filtering custom posts by using checkboxes for taxonomy in an ajax loop always gives server 500 error
- AJAX to add to cart multiple products woocommerce
- gettint error 400 with AJAX
- Using wp_editor() when not logged stopped working
- Modifying child theme’s header
- Adding extra data to shortcode attributes and pass it to JS with wp_localize_script
- How to change the value of a variable using input field?
- Show the subcategory name based on current product
- Show subcategory name selected in specific category woocoommerce
- Javascript / PHP – closing the loop
- Filter portforlio with librairie isotop
- I can’t load my images from a js file using wp_localize_script
- Javascript Tab Gallery with Advanced Custom Fields
- How to output values from a loop into a javascript array
- Pulling Products from an API
- Cannot successfully execute AJAX script to call function.php specific function. Using XAMPP localhost to test
- sessionStorage saves input value in browser but it is not loaded in the form field
- Collapsible menu on post sidebar only expands and does not collapse
- Replacing entire tag with shortcode – JavaScript [duplicate]
- wordpress dependent dropdownlist using post type is not working
- Move Jquery.js to Footer
- Bring Font Awesome icons inside menu A tags
- How do I make comment-reply-button with that takes to comment reply form on click
- Call jQuery function from PHP?
- custom post type column countdown
- How to find php variable of wordpress theme settings
- How to echo a PHP code into WooCommerce variation product?
- How can i get the same ajax result using WP REST API instead of admin-ajax?
- How to call a function from functions.php with ajax?
- ajax polling with admin-ajax.php
- Pass product object to javscript
- admin-ajax.php 400 bad request – whats wrong with my code?
- Custom Post type Ajax search results
- WordPress load javascript file if something… (after the page is loaded)
- include javascript Multiple files in wordpress through script.js
- Automatically refresh page if widget is added to page?
- wordpress all post filter by year
- number of posts with “Load More”
- Serve cookie free URLs in WordPress without using a CDN
- Call custom JS function from PHP
- Ajax wordpress function showing source code in alert and not value of input field?
- custom field – changing an element or background of id div – different versions not working
- How to send Ajax Call from frontend without using wp_localize_script in Theme
- Target a specific container to style on WordPress storefront theme
- Add class to all meta boxes for a custom post type
- Full search and replace isn’t enough to make all pictures to be loaded with https
- Complex PHP for json_encode > how to handle/output right?
- I want url from a file in media using title file
- scroll scrpit to particular button position to next id when click button
- How to load WP_Editor JS files manually (with AJAX)?
- make an array in wordpress cusmization api?