Using advanced custom fields from one custom post type in another custom post type / using nested shortcodes

I think that, as you are using a Relationship model in your ACF settings, you have to iterate through the elements on your page. For that reason, you can simply use the code from the ACF docs, and add it to your single.php or page.php. https://www.advancedcustomfields.com/resources/relationship/ If you still want to use shortcodes, you can … Read more

Able to edit custom post, but unable to create new custom post when within submenu. What capability is missing?

I couldn’t find an answer to this question with User Roles Editor, but I have worked around this problem by showing different admin panels for different users. When Plugin Admin logs in, the custom post type is not put under a menu, so they can create new custom posts. When the Administrator logs in, the … Read more

wp_get_archives() not working for my custom post type

wp_get_archive() does not work natively with custom post type, even if the official documentation let suppose it’s possible to use CPT as argument ( https://codex.wordpress.org/Template_Tags/wp_get_archives) post_type (“string”) Limit archives to a post type. Default is ‘post’. (since Version 4.4) You can find discussion and possible workaround in this stackoverflow post: https://stackoverflow.com/questions/8943251/wp-get-archives-for-custom-post-type-not-working and here: Custom Post … Read more

WooCommerce sort products by the actual product width(not the shipping width)

The Below code works for simple products but fails for products with variance add_filter( ‘woocommerce_get_catalog_ordering_args’, ‘sort_by_width_woocommerce_shop’ ); function sort_by_width_woocommerce_shop( $args ) { global $wp_query; $orderby_value = isset( $_GET[‘orderby’] ) ? wc_clean( (string) wp_unslash( $_GET[‘orderby’] ) ) : wc_clean( get_query_var( ‘orderby’ ) ); if ( ‘width-asc’ == $orderby_value ) { $args[‘orderby’] = ‘meta_value_num’; $args[‘order’] = ‘ASC’; … Read more