ACF Option page

3. December 2019

 * ACF option page.
if( function_exists( 'acf_add_options_page' ) ) {
		'page_title' 	=> __( 'Extra settings' ),
		'menu_title'	=> __( 'Extra settings' ),
		'menu_slug' 	=> 'extra_settings',
		'capability'	=> 'delete_pages',
		'redirect'		=> false,
		'position'		=> 63,
		'icon_url'		=> 'dashicons-minus'
<?php the_field('name_of_the_field', 'option'); ?>
Remove surname from comments

2. December 2019

Change of this field: .woocommerce-review__author

 * Change the comment name to show only Firstname.
function twstudio_my_comment_author( $author = '' ) {

	$comment = get_comment( $comment_ID );
	if ( ! empty( $comment->comment_author ) ) {
		if ( $comment->user_id > 0 ) {
			$user   = get_userdata( $comment->user_id );
			$author = $user->first_name . ' ' . substr( $user->last_name, 0, 0 ) . '';
		} else {
			$author = __( 'No name' );

	return $author;

add_filter( 'get_comment_author', 'twstudio_my_comment_author', 10, 1 );
Change Posts to News in wp-admin

20. November 2019

This goes in functions.php for example.

function tws_change_post_object() {
    $get_post_type = get_post_type_object('post');
    $labels = $get_post_type->labels;
        $labels->name = 'News';
        $labels->singular_name = 'News';
        $labels->add_new = 'Add News';
        $labels->add_new_item = 'Add News';
        $labels->edit_item = 'Edit News';
        $labels->new_item = 'News';
        $labels->view_item = 'View News';
        $labels->search_items = 'Search News';
        $labels->not_found = 'No News found';
        $labels->not_found_in_trash = 'No News found in Trash';
        $labels->all_items = 'All News';
        $labels->menu_name = 'News';
        $labels->name_admin_bar = 'News';
add_action( 'init', 'tws_change_post_object' );
Force update of a JS file in WP (prevent cache)

21. October 2019

If this is the old register script:

Then you should change it to:

Then the file gets a version number, witch means, it would be updated to all users. Then you are sure that there is no cache of the file.

Create a custom shortcode for WordPress

28. May 2019

Add WordPress user with code

15. March 2019

This goes into functions.php. Remember to remove the code as soon as you have logged in

Add custom field to the ‘My Account’

13. March 2019

Remember to create a new ACF field and set the Location to ‘User Form is equal to Add /edit’ (‘Brukerskjema er lik Legg til / Rediger’)

Tracking Contact Form 7 (CF7) with Google Tag Manager (GTM)

9. January 2019

Hide the product’s weight and dimensions

7. January 2019

A really simple Wp Query

15. December 2018

Enable/Disable the ‘Ship to a different address?’ checkbox

10. December 2018

To Enable:

To Disable:

Check filename ending & a fileuploader

19. September 2018


To use with ACF


Change WooCommerce Email style

22. August 2018


Remove the redundant words from WooCommerce Tabs

31. July 2018

Goes into woocommerce.php

Update cart without the update button in cart.php

31. July 2018

Goes into woocommerce.php or functions.php


Add TILBEHØR (accessories) to WC Tab on single product page

30. July 2018


Add extra space to the breadcrumbs

30. July 2018

Goes into woocommerce.php (or functions.php, but you should have a woocommerce.php if you have woocommerce running on your site)


Check if a product is in stock

27. July 2018


Change the default ‘Sale’ text to custom

24. July 2018

Goes into functions.php:


Check if user is logged in and do something

10. July 2018


Get site url

8. July 2018

Gives you the sites url..

<?php echo get_site_url(); ?>

Gives you a specific page:

Gives you an image:

Change sorting

2. July 2018

Change sorting on products that are ‘connected’ to a product

Goes into the functions.php

Change the orderby and order, to change order.

If you just going to change Standart sorting on all Products. Go to: WooCommerce -> Settings -> Products -> Display -> Default Product Sorting

Check if a template is in use

13. June 2018

This snippet is collected from a plugin, to check if the theme folder has a xyz.php file, if not, then the xyz.php from the plugin is loaded.


Using the GDPR app with cookies

28. May 2018

How to make sure the user have the possibility to disable a cookie, goes into function.php NB! HAVE NOT BEEN TESTED BY ME:

See also:

Add Length, Height and Width to Single-product

16. May 2018

Goes into functions.php

Set the Thumbnail size

15. May 2018

This goes into your theme setup function in functions.php

(To register new sizes:

Hook example

8. May 2018

Add Taxonomies for media gallery

6. May 2018

Goes into functions.php

Register a custom post type

21. April 2018

This goes into functions.php

WP-CLI nice to know

20. April 2018

Inside your www folder

Edit text in WooCommerce Message Error

20. April 2018

Search fix. Hide hidden products when searching.

20. April 2018

Add breadcrumbs to your wordpress site using Yoast SEO

18. April 2018

This goes to your single.php or page.php:

Second, activate breadcrumbs in Yoast CEO plugin.

How to activate the form for password protection

18. April 2018

This goes into the single.php for example.

//Your HTML content goes her

Hide/show password protected posts on specific pages

18. April 2018

This goes into functions.php

To hide Password Protected posts from the ‘loop’

18. April 2018

This goes into functions.php