• I am using [ccc_my_favorite_list_custom_template style=””] to create a custom list layout and it’s working ok, but I have an issue when removing items:

    1.) Logged User – Clicking the delete icon fads out the favorited item, but then it fades back in. The count in listing heading updates correctly and then reverts back to what it was ( toggles to 0 and then back to 1 ). The count in the site header [ccc_my_favorite_list_menu slug=”” text=”” style=””] get updated correctly. Manually refreshing the page should the correct listing. The delete all works as expected.

    Anonymous users – it works fine and if I use your default list shortcode it works fine.

    Also is there an easy way to use local storage for both logged in and anonymous users?

    Code

    function ccc_my_favorite_list_custom_template( $my_favorite_post_id=false ) {
        session_start();
       // var_dump($my_favorite_post_id);
        $key = 'ccc-my_favorite_post'; // localstorage key
        $_SESSION[$key] = $my_favorite_post_id; // Now stored in php′s session variable $_SESSION['my_favorite_post']
       // var_dump($_SESSION[$key]);
       
        $args= array(
          'post_type' => 'speaker',
          'post__in' => $my_favorite_post_id,
          'orderby' => 'post__in',
          'posts_per_page' => -1,
        );
        $the_query = new WP_Query($args);
        if( $the_query->have_posts() ) {
        ?>
        <p id="ccc-favorite-count"><span class="number"><?php echo $the_query->post_count; ?></span></p>
        <div data-ccc_favorite-delete_all=true><a href="#" class="ccc-favorite-post-delete-button">All Delete</a></div>
    
        <div class="list-ccc_favorite wrapper">
        <?php
            while( $the_query->have_posts() ) {
                $the_query->the_post();
        ?>
        <?php
        if( has_post_thumbnail() ) {
          echo '<div class="col-2 wrapper"><img src="'.get_the_post_thumbnail_url($the_query->post->ID, 'thumbnail').'" /></div>';
        } 
        /* 
         * Your custom field
         * Please write the code to output your custom field.
         */
        ?>
        <div class="col-10 col--vcent">
        <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><!-- /.title-post -->
        <div class="ccc-favorite-post-toggle"><a href="#" class="ccc-favorite-post-toggle-button" data-post_id-ccc_favorite="<?php echo $the_query->post->ID; ?>"></a></div><!-- /.ccc-favorite-post-toggle -->
        </div>
      <?php
    
          } //endwhile
        echo '</div>';
        } //endif
      } // endfunction
    • This topic was modified 2 years, 3 months ago by ebud.
    • This topic was modified 2 years, 3 months ago by ebud.
Viewing 1 replies (of 1 total)
  • Plugin Author Takashi Matsuyama

    (@takashimatsuyama)

    Hello @ebud ,

    Thank you for your question.
    Sorry for the delay in answering.

    Unfortunately, I am unable to determine the cause of the problem based solely on the information in this topic.

    Perhaps this topic is a little closer.

    Also is there an easy way to use local storage for both logged in and anonymous users?

    Unfortunately, that is not possible with the standard features of this plugin.
    The only way is to modify the JS and PHP files directly.

    Thanks

Viewing 1 replies (of 1 total)
  • The topic ‘Custom List Template’ is closed to new replies.