This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$postal_code = $_POST['postal_code']; | |
if ( preg_match( '/[0-9]{5}/', $postal_code ) ) { | |
update_post_meta( get_the_ID(), 'postal_code', $postal_code ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$postal_code = preg_replace( '/[^0-9]/', '', $_POST['postal_code'] ); | |
update_post_meta( get_the_ID(), 'postal_code', $postal_code ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="<?php echo esc_attr( $_POST['layout'] ); ?>"> | |
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy... | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input name="s" placeholder="<?php esc_attr_e( 'Search', 'textdomain' ); ?>" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1><?php echo esc_html( $title ); ?></h1> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="<?php echo esc_url( home_url( '/' ) ); ?>"> | |
<img src="<?php echo esc_url( get_stylesheet_directory_uri() . '/img/logo.png' ); ?>" /> | |
</a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<label> | |
<span><?php _e( 'Label', 'textdomain' ); ?></span> | |
<textarea name="message"><?php echo esc_textarea( $_POST['message'] ); ?></textarea> | |
</label> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
var name = '<?php echo esc_js( $_POST['name'] ); ?>'; | |
</script> | |
<a href="<?php echo esc_url( home_url( '/blog/' ) ); ?>" | |
onclick="<?php echo esc_js( 'alert("Welcome " + name);' ); ?>"> | |
<?php _e( 'Blog', 'textdomain' ) ?> | |
</a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $wpdb; | |
$query = $wpdb->prepare( | |
"SELECT * FROM {$wpdb->posts} WHERE post_type = %s", | |
$post->post_type | |
); | |
$results = $wpdb->get_results( $query ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $wpdb; | |
$post = get_post(); | |
$query = $wpdb->prepare( | |
"SELECT * FROM {$wpdb->posts} WHERE post_type LIKE %s", | |
'%' . like_escape( $post->post_type ) . '%' | |
); | |
$results = $wpdb->get_results( $query ); |