This file contains 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 | |
// Retrieving a simple order | |
$order = wc_get_order( 1234 ); | |
// Then we can get info related to this order by running. | |
$order->get_id(); | |
$order->get_total() | |
// Also we could retrieve a collection of orders by running. |
This file contains 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 | |
/** | |
* See the next link to understand more about this filter hook. | |
* | |
* @see https://developer.wordpress.org/reference/hooks/the_content/ | |
* @param string $content - the post content. | |
* @return string $content - the content updated | |
*/ | |
function add_footer_to_post_content( $content ) { |
This file contains 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 | |
/** | |
* See the following link to know the arguments passed by this action. | |
* | |
* @see https://developer.wordpress.org/reference/hooks/post_updated/ | |
* @param int $post_ID - the post ID updated | |
* @param WP_Post $post_after - Post content after updated | |
* @param WP_Post $post_before - Post content before updated. | |
*/ |
This file contains 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 | |
/** | |
* An action hook recives four params. | |
* | |
* @param string $hook_name - The name of the hook | |
* @param callable $callback - The callback where we are going to add our logic. | |
* @param int $priority - The priority of the hook. Used to specify the order in which the functions associated with a particular action are executed. | |
* @param int $params - The number of arguments the function accepts | |
*/ |