This is purely for example and educational purposes.
The resulting contact form you will create with this example is extremely insecure. Do not use it on a live website.
- Create
websitedirectory on Desktop - Open terminal and test PHP
php --version
| <?php | |
| /* One of the upload fields as an example */ | |
| ?> | |
| <tr> | |
| <th><label for="ols_user_meta_image_1"><?php _e( 'OLS Image 1', 'textdomain' ); ?></label></th> | |
| <td> | |
| <!-- Outputs the image after save --> | |
| <img src="<?php echo esc_url( get_the_author_meta( 'ols_user_meta_image_1', $user->ID ) ); ?>" style="width:150px;"><br /> | |
| <!-- Outputs the text field and displays the URL of the image retrieved by the media uploader --> |
| /** ==================================================================================== | |
| * Functions file | |
| ==================================================================================== **/ | |
| function yourthemeprefix_yourcpt_metabox_register() { | |
| $prefix = '_cmb_'; |
| /** | |
| * is_type can be simple, variable, grouped, external | |
| * woocommerce_single_product_summary is hook! | |
| * Put this into your functions.php (child-theme) | |
| **/ | |
| add_action( 'woocommerce_single_product_summary', 'get_product_type', 5 ); | |
| function get_product_type() { | |
| global $post; | |
| if( function_exists('get_product') ){ | |
| $product = get_product( $post->ID ); |
| <?php | |
| // if there's a namespace, add it the body class | |
| $classes[] = esc_attr( $theme_options['themename_namespace'] ); | |
| if ( isset( $post ) ) { | |
| $classes[] = esc_attr( $post->post_type . '_' . $post->post_name ); | |
| } | |
| if (is_single() ) { | |
| foreach((wp_get_post_terms( $post->ID)) as $term) { |
| cd .. | |
| # Install CodeSniffer for WordPress Coding Standards checks. | |
| git clone https://github.com/squizlabs/PHP_CodeSniffer.git php-codesniffer | |
| # Install WordPress Coding Standards. | |
| git clone https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git wordpress-coding-standards | |
| # Hop into CodeSniffer directory. | |
| cd php-codesniffer | |
| # Set install path for WordPress Coding Standards | |
| scripts/phpcs --config-set installed_paths ../wordpress-coding-standards | |
| # After CodeSniffer install you should refresh your path. |
| DELETE FROM `wp_options` WHERE `option_name` LIKE ('%\wc_session\_%') | |
| DELETE FROM `wp_options` WHERE `option_name` LIKE ('%\_transient\_%') |
This is purely for example and educational purposes.
The resulting contact form you will create with this example is extremely insecure. Do not use it on a live website.
website directory on Desktopphp --version| // needed for viewport size detection in javascript | |
| body::before { | |
| display: none; | |
| content: "xs"; | |
| } | |
| @media (min-width: $screen-sm-min) { | |
| body::before { | |
| content: "sm"; | |
| } |
| <?php | |
| // To be used by theme authors to avoid duplicate favicon code now that Site Icons have been added to WordPress 4.3 | |
| // If a Site Icon hasn't been set or if the `has_site_icon` function doesn't exist (ie older than WordPress 4.3) | |
| if ( ! ( function_exists( 'has_site_icon' ) && has_site_icon() ) ) { | |
| // your theme specific custom favicon code goes here | |
| } |