• Hello I am not a big programmer.

    I need to get data (favorited posts ids) from LocalStorage and use it in my php template.

    I am trying to filter favorited posts by different categories for non logged users.

    In file list.php is this:

    $ccc_my_favorite_post = sanitize_text_field( $_POST[‘ccc-my_favorite_post’] );
    $my_favorite_post_ids = explode(‘,’, $ccc_my_favorite_post);

    So in my php template I tryed this:
    $ccc_my_favorite_post = sanitize_text_field( $_POST[‘ccc-my_favorite_post’] ); echo $ccc_my_favorite_post;

    or

    $my_favorite_post_ids = explode(‘,’, $ccc_my_favorite_post);
    print_r($my_favorite_post_ids);

    But I can not see favorited posts ids from LocalStorage.

    Please, can you write to me code, for getting favorited posts ids from LocalStorage and use it in my php template?

    Thank you.

    David

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Get data from LocalStorage to php template’ is closed to new replies.