Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function custom_html_render_shortcode_wp543( $attr ){
- $id = ( isset( $attr['id'] ) && !empty( $attr['id'] ) ) ? sanitize_text_field( $attr['id'] ) : null;
- $width = ( isset( $attr['w'] ) && !empty( $attr['w'] ) ) ? sanitize_text_field( $attr['w'] ) : '160';
- $width .= 'px';
- $page = ( isset( $attr['page'] ) && !empty( $attr['page'] ) ) ? sanitize_text_field( $attr['page'] ) : null;
- ob_start();
- if( !$id ):
- echo '<div class="url-missing">Please, Enter a valid ID</div>';
- else: ?>
- <iframe style="width:100%; height:<?php echo esc_attr( $width ); ?>;" src="https://<?php echo esc_attr( $id ) ?>.exprealty.com/<?php echo esc_attr( $page ); ?>" allowtransparency="true" frameBorder="0"> </iframe>
- <?php endif;
- return ob_get_clean();
- }
- add_shortcode('exprealty-code','custom_html_render_shortcode_wp543');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement