R
R
Roman Tuzov2020-07-06 20:27:59
WordPress
Roman Tuzov, 2020-07-06 20:27:59

Who has worked with the WP All Import (pro) filter and plugin?

THE QUESTION IS NOT A BIG QUESTION. Just a lot of pictures and code inserts :)
I have a program:

<?php  $query = new WP_Query( 'post_type=program-card' ); ?>
  <?php while ( $query->have_posts()):$query->the_post(); ?>
  <div class="card-item level-<?php the_field('card_level-id'); ?> direction-<?php the_field('card_direction-id'); ?> university-<?php the_field('card_university-id'); ?> program-<?php the_field('card_program-id'); ?> language-<?php the_field('card_language-id'); ?>">
              
    <div class="card-item_middle">
      <ul>
        <li>
                        <p>Уровень обучения</p>
                        <h3><?php the_field('card_level-rus'); ?></h3>
                      </li>
                      <li>
                        <p>Форма обучения</p>
                        <h3><?php the_field('card_form-rus'); ?></h3>
                      </li>
                      <li>
                        <p>Код программы </p>
                        <h3><?php the_field('card_code'); ?></h3>
                      </li>
                      <li>
                        <p>Продолжительность</p>
                        <h3><?php the_field('card_during-rus'); ?></h3>
                      </li>
                      <li>
                        <p>Степень или квалификация</p>
                        <h3><?php the_field('card_level-rus'); ?></h3>
                      </li>
                      <li>
                        <p>Язык обучения</p>
                        <h3><?php the_field('card_language-rus'); ?></h3>
                      </li>
                    </ul>
                    <p>Куратор</p>
                    <h3><?php the_field('card_curator'); ?></h3>
                    <div class="contact">
                      <p><?php the_field('card_phone'); ?></p>
                      <a href="mailto:<?php the_field('card_email'); ?>"><?php the_field('card_email'); ?></a>
                    </div>
                  </div>
                </div>
                <?php endwhile; ?>
                <?php wp_reset_postdata(); ?>

I add with the help of separate posts and using acf pro, as you can see. There are more than 500 such programs, so I add using wp all import (pro) with custom fields named exactly the same as the fields in the program (<?php the_field('card_phone'); ?> only in wp all import I specify only card_phone ). But for such an amount, a filter is also needed, which, to be honest, I have no idea how to do, that's why I asked the opinions of the pros)
The filter looks like this:5f035ceb58c28248780685.png
The direction field is repeated, so I did it through the taxonomy so that a similar field could not be added. But here I ran into a problem. Firstly, it takes a very long time to add all the directions and manually select the right one too. Then I decided to add using the same acf, only using a repeater) It didn’t work out for me) By the way, the code for the "Directions of Education" (one section from the filter that I made up. value option'a is directly related to the class on the card (more details at the end )):
<p>Направление образования</p>
<select id="direction1">
        <option value="card-item">Любой</option>
  <?php while ( have_rows('card-direction-repeat','option') ) : the_row(); ?>
    <option value='direction-<?php the_sub_field('card_direction-id','option'); ?>'><?php the_sub_field('card_direction-id','option'); ?></option>
       <?php endwhile; ?>
</select>

Options by the way because I use the options page added via functions. This is how it looks, an empty field, unfilled for some reason:
5f035dfdeffef750802207.png
How I filled it out through wp all import:
5f035e76edb7f189541134.png
In GENERAL, I already told everything that is possible, in my opinion. Who can tell you the best way to make a filter for all programs added via wp all import?)
By the way, here is the code that I use now for filtering (the classes on each card are different, taking into account the value option'a):
// Фильтрация программ
    function applyFilters() {
    	// Инициализация классов
     	var direction1 = $("#direction1").val();
      var level1 = $("#level1").val();
      var universities = $("#universities").val();
      var language = $("#language").val();
      var program = $("#program").val();
      // Создания селектора
      var selector = "#card-wrapper-first ." + direction1 + "." + level1 + "." + program + "." + language + "." + universities;

      // Появление нового запроса
      $('#card-wrapper-first .card-item').hide();
      $(selector).show();
    }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question