• Resolved joshkern

    (@joshkern)


    I’m trying to import recipes but having difficulty with the instructions. Inline html tags li <a>, <strong>, or <em> cause a new paragraph.

    For example, “Thoroughly combine all the ingredients in a small bowl”

    becomes:

    Thoroughly combine

    all the ingredients in a small bowl.”

    My code is below. I would appreciate any insight or guidance.

            $acf_instructions = get_post_meta( $id, 'directions_sections_1_direction_list', true );
            preg_match_all( '!<li>(.*?)</li>!', $acf_instructions, $instruction_matches );
    
            foreach ( $instruction_matches[1] as $instruction_match ) {
                $instruction_match = trim( $this->derichify( $instruction_match ) );
    
                $group['instructions'][] = array(
                    'text' => $instruction_match,
                );
            }
    
            $instructions[] = $group;
            $recipe['instructions'] = $instructions;
    • This topic was modified 6 months, 2 weeks ago by joshkern.
    • This topic was modified 6 months, 2 weeks ago by joshkern.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Brecht

    (@brechtvds)

    Is that derichify function doing anything special?

    Just to be clear: it stays 1 instruction step but gets split in the rich editor field?

    Could you test surrounding the entire text with a paragraph tag and see if that makes a difference?

    Thread Starter joshkern

    (@joshkern)

    Wrapping in a paragraph tag seems to have done the trick. Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom importer – inline html tags cause new paragraph’ is closed to new replies.