How to upload WP user avatar on woocommerce account page [closed]

Ok, now it’s time to get your hands dirty. Open up your functions.php file located in wp-content/themes/your-theme-name/ and add this code in it: /** * Print the customer avatar in My Account page, after the welcome message */ function storefront_myaccount_customer_avatar() { $current_user = wp_get_current_user(); echo ‘<div class=”myaccount_avatar”>’ . get_avatar( $current_user->user_email, 72, ”, $current_user->display_name ) . … Read more

Show ACF field with link to ultimate member profile/WordPress user profile below the post (single post layout)

I believe that your syntax is wrong in the variables you set up in your foreach loop. Because you’re referencing an object and not an array, you need to use this format: $author_ID = $value->ID and… $value->display_name We also discovered that the foreach loop isn’t necessary, so I’m removing it from the answer. The other … Read more

parsing nested blocks (in columns, etc) via PHP

If I understand it correctly, you can use a recursive function which loops through inner blocks to find the specific block. Example: /* Sample usage, assuming $post is defined properly: $blocks = parse_blocks( $post->post_content ); wpse_387661( $blocks ); */ function wpse_387661( $blocks ) { foreach ( $blocks as $block ) { if ( ! empty( … Read more

Code snippet to show current php version inside “At a Glance” box in admin

This one will add php version at the bottom of ‘at a glance’ metabox, where goes wordpress version with active theme name. function update_right_now_text_callback($content){ $php_version = __(‘PHP version: ‘) . phpversion(); return $php_version . ‘ | ‘ . $content; } add_filter( ‘update_right_now_text’, ‘update_right_now_text_callback’ ); If you want to add it as content list item for … Read more

Loading two post layouts for the same post with different url

You can pass the layout name as a GET parameter and then change the design based on that. So your URL should be something like this: http://domain.com/post-name?layout=layout-1 Now in your single.php file or whatever file that renders the template, you can do this check to show the different layouts: <?php // If the header is … Read more

Create page template via functions.php?

Your previous question, Possible to create a “variant” page template that only contains differences and is therefore resilient to updates of original (ie page.php)?, provided nicely more context to this question. As you Sally CJ noted in the comments you use theme_page_templates to add custom template to the template select list. To skip adding a … Read more

Upload multiple files in randomly generated folder using wp_upload_bits

Apply the following fixes (those with the // Fix <number>: comment) and your code would work in that only one random folder that will be created for all the uploads in the current session: (Note: I presumed the $countfiles is properly defined in your actual code.) function file_upload_callback() { global $wpdb; $table_name=”wp_order_quotes_real”; $_filter = true; … Read more