How to show only part of product name in category page – WordPress with woocomerce

I solved this problem with: function hide_product_title_part( $title, $id ) { if ( ( is_front_page() || is_shop() || is_product_tag() || is_product_category() ) && get_post_type( $id ) === ‘product’ ) { if (strstr($title, “:”)) { $new_title = explode(“:”, $title); return $new_title[1]; } else { return $title; } } else { return $title; } } add_filter( ‘the_title’, … Read more

ACF | WooCommerce | Theme Development | How to include a /template-part/ that makes use of ACF’s on a custom WooCommerce homepage?

You cannot include template files via URL, which is what get_template_directory_uri() returns. You need to use the server file path, which you get get with get_theme_file_path(): $heroslider = get_theme_file_path( ‘template-parts/hero-slider.php’ ); echo $heroslider; include_once( $heroslider ); However, if you’re including templates (rather than files with function/class definitions), you should use get_template_part() to get the correct … Read more

How keep woocommerce users separeted in multisite install and keep admins on network

I don’t know if is the best way to do this but aparently works well. I override the users table adding one with an blog_id field as key. Add an “wp_pre_insert_user_data” filter to set the blog_id field and change the user id to some like “blog_id000user_id” (100044 for example is from blog 1). Override the … Read more

Gravity Forms – Prevent Multiple Form Entries Same User ID with Same Field Value

https://gravitywiz.com/documentation/gravity-forms-limit-submissions/ Gravity Perks is a great addon to gravity forms that does a lot of cool things. This particular add on would solve this problem – plus they have great support. I found this on github – I gave it a try and it didn’t break my site: https://github.com/uamv/gravityforms-custom-entry-limit Not sure if that means per … Read more

Display a list of posts corresponding to a category

As an alternative, consider using get_posts()? get_posts() It will require other changes to your code but you can easily create a query to include Categories, and then foreach through the results. Update: Here’s an equivalent to your code written with get_posts(). Take a copy of your own code first but the below would replace it … Read more

Accessing WordPress Functions get_permalink() in Vanilla PHP?

The developer’s reference is a great place to start. You’ll find get_permalink in wp-includes/link-template.php. You might want to look into wp-cli wp post list –post__in=1 –field=url should do the trick as discussed in wp-cli issue#2727 Also, there’s the rest-api to consider. The best solution for getting the permalink might be to just post/cURL a request … Read more

Remove /category/ from category (archive) page URLs (without using a plugin)

Please add this code in functions.php to remove the “category” text from permalink. function remove_category( $string, $type ) { if ( $type != ‘single’ && $type == ‘category’ && ( strpos( $string, ‘category’ ) !== false ) ){ $url_without_category = str_replace( “/category/”, “/”, $string ); return trailingslashit( $url_without_category ); } return $string; } add_filter( ‘user_trailingslashit’, … Read more