Divi WordPress Theme
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WordPress fix Reply To: while() and newline (\n), how does it make sense?

Discussion in 'Misc WordPress Requests' started by TheDani, Mar 25, 2018.

  1. TheDani

    Guest

    Reply To: while() and newline (\n), how does it make sense?, by TheDani

    No,

    $activities = get_post_meta(get_the_ID(), "activities", false); //activity -ies
    $ids = array_column($activities, 'ID');
    $args = array(
    'post_type' => 'activity',
    'posts_per_page'=>'-1',
    'post__in' => $ids,
    'orderby' => 'post__in',
    );
    $query = new WP_Query($args);
    while($query->have_posts()) :
    $query->the_post();
    $activities_label = get_post_meta(get_the_id(), 'activities_label', true);
    echo "<br>".get_the_title();
    if (strpos($activities_label, "\n") !== false || false !== strstr($activities_label, PHP_EOL)) {
    echo "<br>".$activities_label."<br><br>";
    }
    endwhile;

    //result

    Bad Karma
    Blue Elephant
    Rose

    Reply To: while() and newline (\n), how does it make sense?
     
    #1

Share This Page

Monarch Social Sharing Plugin