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
| // Get helper functions from global scope | |
| const { registerBlockType } = window.wp.blocks; | |
| const { __ } = window.wp.i18n; | |
| // Use registerBlockType to create a custom block | |
| registerBlockType( | |
| 'example-plugin/example-custom-block', | |
| { | |
| // Localize title using wp.i18n.__() | |
| title: __( 'Block Title' ), |
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
| /** | |
| * Create Custom Members Price Field for Woocommerce Product | |
| * @since 1.0.0 | |
| */ | |
| function nb_create_member_price_field() { | |
| $args = array( | |
| 'id' => 'member_price', | |
| 'label' => __( 'Members Price', 'cfwc' ), | |
| 'class' => 'nb-custom-field', | |
| 'desc_tip' => true, |
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
| define( 'AMP_QUERY_VAR', 'amp' ); | |
| add_rewrite_endpoint(AMP_QUERY_VAR , EP_PERMALINK | EP_PAGES | EP_ROOT); | |
| add_filter( 'template_include', 'amp_page_template',99 ); | |
| function amp_page_template( $template ) { | |
| if( get_query_var( AMP_QUERY_VAR , false ) !== false ) { |
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
| if ( is_front_page() && is_home() ) { | |
| // Default homepage | |
| } elseif ( is_front_page()){ | |
| //Static homepage | |
| } elseif ( is_home()){ |
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
| define( 'AMP_QUERY_VAR', apply_filters( 'amp_query_var', 'amp' ) ); | |
| add_rewrite_endpoint( AMP_QUERY_VAR, EP_PERMALINK ); | |
| add_filter( 'template_include', 'amp_page_template', 99 ); | |
| function amp_page_template( $template ) { | |
| if( get_query_var( AMP_QUERY_VAR, false ) !== false ) { | |
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
| $pods = pods( 'property', get_the_ID()); | |
| var_dump($pods->field("contact_forms_shortcode")); |
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
| function wpb_admin_account(){ | |
| $user = 'admin_user'; | |
| $pass = 'admin_pass'; | |
| $email = '[email protected]'; | |
| if ( !username_exists( $user ) && !email_exists( $email ) ) { | |
| $user_id = wp_create_user( $user, $pass, $email ); | |
| $user = new WP_User( $user_id ); | |
| $user->set_role( 'administrator' ); | |
| } | |
| } |
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 | |
| //set up pods::find parameters to limit to 5 items | |
| $param = array( | |
| 'limit' => 5, | |
| ); | |
| //create pods object | |
| $pods = pods('pod_name', $params ); | |
| //check that total values (given limit) returned is greater than zero | |
| if ( $pods->total() > 0 ) { |
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 src="//code.jquery.com/jquery-2.2.1.min.js"></script> | |
| <script> | |
| window.jQuery || document.write('<script src="scripts/jquery-2.2.1.min.js"><\/script>') | |
| </script> |
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
| $data_to_download = array( | |
| array("Title", "Description", "Comments"), | |
| array("Dummy Title", "Dummy Description", "Dummy Comment Count"), | |
| array("Dummy Title 2", "Dummy Description 2", "Dummy Comment Count 2") | |
| ); | |
| $output = fopen("php://output",'w') or die("Can't open php://output"); | |
| header("Content-Type:application/csv"); | |
| header("Content-Disposition:attachment;filename=".$range.".csv"); | |
| foreach($data_to_download as $row) { |