Support

Account

Forum Replies Created

  • Thank you John, this is first class excellent information. Very helpful Thanks.

  • Sorry for any confusion but I managed to get it working.

    if ("home_report_url" === $tag) {
    		$homereportlink = get_field("home_report_url", get_the_ID());
    		if( $homereportlink ): $home_link_url = $homereportlink['url'];
    		$content = str_replace("{home_report_url}", $home_link_url, $content);
    		endif;
        }
    return $content;
  • Hi,

    I’m currently trying to set up a custom tag with ACF link type field. This process works fine for text based fields, but I’m having problems, I believe because it’s a link field and trying to capture the object URL value.

    The form is inside a single product page, and it should capture the value, but I can’t seem to get it working.

    Any advice would be much appreciated.

    Thanks

    Snippet…

    
    if ("home_report_url" === $tag) {
            $homereportlink = get_field_object("home_report_url", get_the_ID());
    		if($homereportlink) {$home_link_url = $homereportlink['url'];}
            $content = str_replace("{home_report_url}", $home_link_url, $content);
        }

    Full Code…

    
    function wpf_dev_register_smarttag($tags) {
    $tags["home_report_url"] = "Home Report URL";
        return $tags;
    }
    add_filter("wpforms_smart_tags", "wpf_dev_register_smarttag");
    function wpf_dev_process_smarttag($content, $tag) {
    	if ("home_report_url" === $tag) {
            $homereportlink = get_field_object("home_report_url", get_the_ID());
    		if($homereportlink) {$home_link_url = $homereportlink['url'];}
            $content = str_replace("{home_report_url}", $home_link_url, $content);
        }
        return $content;
    }
    add_filter("wpforms_smart_tag_process", "wpf_dev_process_smarttag", 10, 2);
  • Thanks John.

    Got it, works a treat.

    add_action( 'pre_get_posts', 'product_rmreference_column_orderby' );
    function product_rmreference_column_orderby( $query ) {
      if( ! is_admin() || ! $query->is_main_query() ) {
        return;
      }
    
      if ( 'reference_id' === $query->get( 'orderby') ) {
    	$query->set( 'orderby', 'meta_value' );
    	$query->set( 'meta_key', 'reference_id' );
        $query->set( 'meta_type', 'numeric' );
      }
    }
  • Thanks, John, but unfortunately still ‘No Products found’.

    Noob question, but do I need to add _ref the meta_key in the field settings inside ACF? – Currently, it’s just a simple text based field.

    Thanks

Viewing 6 posts - 1 through 6 (of 6 total)