Support » Plugin: Events Manager » Get post_id

  • Resolved ositive

    (@ositive)


    Hi
    I would like to get the post id list (i.e. comma-separated) from the posts filtered with $arg. I know that if I use the get function (below), I obtain all the post attribute values filtered with $arg array values: how can I get the post_id (as said, i.e. comma-separated) from $dd?

    $dd = EM_Events::get( $args );

    Thanks
    Ositive

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    you can try something like

    
    $events = EM_Events::get( $args );
    foreach ( $events as $EM_Event ){
      echo $EM_Event->post_id;
    }
    

    Thanks!
    I used the following code:
    $events = EM_Events::get( $args );
    foreach ( $events as $EM_Event ){
    echo $EM_Event->post_id .”;”;
    }

    obtaining var_dump($EM_Event) equal to “847;190;187;476;822;NULL”
    the problem is that I need a string, in order to pass it to my shortcode, but $EM_Event is not a string: How can I get the string like “847;190;187;476;822” from $EM_Event?

    Thanks
    Ositive

    Plugin Support caimin_nwl

    (@caimin_nwl)

    NetWebLogic Support

    Try:

    $my_string = '';
    $events = EM_Events::get( $args );
    foreach ( $events as $EM_Event ){
    $my_string .= $EM_Event->post_id .';';
    }

    It works great! thank you!
    I’ll try the same approach for the other templates!
    Thanks
    Ositive

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Get post_id’ is closed to new replies.