How is $current_page passed in woocommerce_account_orders function?

Action hooks can pass variables do hooked callback functions. For example: do_action( ‘my_custom_action’, $a_variable ); For that action, any callback function has access to $a_variable: add_action( ‘my_custom_action’, ‘my_custom_function’ ); function my_custom_function( $a_variable ) { // etc. } The woocommerce_account_orders_endpoint action hook is defined like this: do_action( ‘woocommerce_account_’ . $key . ‘_endpoint’, $value ); Where $value … Read more

Sortable column (by numbers) in admin users

Is there something that I’m missing Yes, you need to actually add the function which will do the sorting based on your usercoins “sort by” value (that you set in your yoursite_manage_users_custom_column_sortable() function). So you would hook your function on users_list_table_query_args, then change the args so that the users are being sorted by the usercoins … Read more

Include the post type before the title of search results

I solved this by copying the divi index.php and placing it in my child theme as search.php I then found where the title and altered it with the below code: <h2 class=”entry-title”> <a href=”<?php the_permalink(); ?>”> <?php $post_type = get_post_type( $post->ID ); echo $post_type . “: “; the_title(); ?> </a> </h2> Probably not the correct … Read more

How to Use Global Variables Inside Header and Footer

In functions.php you can create a constant with the user id, like this. // if somehow this constant exists this will prevent a php error if (!defined(‘CURRENT_USER_ID’)) { // if user is not logged it this constant will contain 0 define(‘CURRENT_USER_ID’, get_current_user_id()); } Now you have a constant variable available anywhere in your theme. To … Read more