A
A
AbsolvoTe2018-02-08 18:57:59
WordPress
AbsolvoTe, 2018-02-08 18:57:59

Wordpress - How to display your post type of a specific category?

Hello!
I created my own post type and taxonomy for it:

function landing_post_types(){
  register_post_type('services', array(
    'labels' => array(
      'name'               => 'Услуги', // основное название для типа записи
      'singular_name'      => 'Услуга', // название для одной записи этого типа
      'add_new'            => 'Добавить новую', // для добавления новой записи
      'add_new_item'       => 'Добавление услуги', // заголовка у вновь создаваемой записи в админ-панели.
      'edit_item'          => 'Редактирование услуги', // для редактирования типа записи
      'new_item'           => 'Новая услуга', // текст новой записи
      'view_item'          => 'Смотреть услугу', // для просмотра записи этого типа.
      'search_items'       => 'Искать услугу', // для поиска по этим типам записи
      'not_found'          => 'Не найдено', // если в результате поиска ничего не было найдено
      'not_found_in_trash' => 'Не найдено в корзине', // если не было найдено в корзине
      'parent_item_colon'  => '', // для родителей (у древовидных типов)
      'menu_name'          => 'Услуги', // название меню
    ),
    'public'              => true,
    'menu_position'       => 25,
    'menu_icon'           => 'dashicons-welcome-learn-more', 
    'hierarchical'        => false,
    'supports'            => array('title', 'editor', 'thumbnail'),
    'query_var'           => false,
  ));

  register_taxonomy('services-taxonomy', array('services'), array(
      'labels'                => array(
        'name'              => 'Рубрики',
        'singular_name'     => 'Рубрика',
        'search_items'      => 'Найти рубрику',
        'all_items'         => 'Все рубрики',
        'view_item '        => 'Посмотреть рубрику',
        'edit_item'         => 'Редактировать рубрику',
        'update_item'       => 'Обновить рубрику',
        'add_new_item'      => 'Добавить новую рубрику',
        'new_item_name'     => 'Добавить новую',
        'menu_name'         => 'Рубрики',
      ),
      'public'                => true,
      'hierarchical'          => true
    ));
}
add_action( 'init', 'landing_post_types' );

Pulling out all entries:
<?php
$args = array(
  'post_type' => 'services',
  'showposts' => 30,
  'order'     => 'ASC',
);

$services = get_posts($args);
foreach ($services as $post) :
  setup_postdata($post);
  ?>
  
  <?php the_content(); ?>

<?php endforeach; ?>

How to display posts of a certain category?

Answer the question

In order to leave comments, you need to log in

12 answer(s)
M
Maksym Davydchuk, 2018-02-08
@AbsolvoTe

tax_query to help you

Z
zoc, 2012-01-30
@zoc

According to my girlfriend's experience, I recommend HTC Rhyme:
- just a female phone
- should meet the agreed amount
- upgrade to 4.0 should be in the first quarter of 2012, that is, soon.

S
super, 2012-01-30
@super

I strongly do not recommend buying an Android smartphone for a friend! I myself bought an Android smartphone for my wife for the new year and regretted it many times:
- It hangs tightly about once a day, you can turn it on only by removing and inserting the battery
- Wi-Fi is connected, but for some reason it wound up an insane amount of traffic over expensive GPRS in a month
- compared to iOS and WP7, the interface is very slow
- Minor glitches, for example, voice input either recognizes in Russian, then spontaneously switches to English

M
masterx, 2012-01-30
@masterx

I had a similar choice 3 months ago. Fortunately, I have friends who are developers for android and I consulted with them about the stability of hardware, software, etc. Well, the prospects for switching to Android 4. They answered me very simply: you need a device with 2 cores. I had a bar: up to 20,000 rubles, and in the end I chose the LG P990 Optimus 2X device . It costs 17 thousand kopecks. Two cores, ready for Android 4. For three months, it proved to be stable (once or twice a month, a reboot still happens), I am satisfied with the purchase. I bought a cover, a film and a spare charging cable on ebay (all together it cost about $ 10).
Oh yes, there is. statement, this model will be one of the few first, under which 4 androids are adapted. And fellow developers also reported that LG makes adaptations very decently, there are few glitches and devices do not crumble like the same HTC (with HTC you are either lucky and it doesn’t break at all, or it crumbles - breakdown after breakdown).
If you need more details, please ask.

A
artleg, 2012-01-30
@artleg

I advise you to look in the direction of smart phones from huawei, do not look that China, the owner of the device itself is from them - no iron problems, and the Soviet ones decided with an official update. On Huawei Honor, ICS is already being tested (officially, but damp). Well, and, of course, the prices will pleasantly please.

E
Evengard, 2012-01-30
@Evengard

I recommended Orange San Francisco (ZTE Blade) to my ex. She had enough, she was quite satisfied. True, I had to roll out alternative firmware several times (it’s generally impossible to work with the standard one in Russia, and the “stable” Kainogens were far from stable - I had to select the necessary Knightley by typing - after which it just worked without being indignant, and did not slow down).
So maybe you should look at these smarts? Chinese. As the previous commenter suggested.

X
xy4, 2012-01-30
@xy4

HTC Desire S has been with my wife for almost a year. Very satisfied.

A
aur, 2012-01-30
@aur

I recommend paying attention to the flagships of Sony Ericsson - Xperia Arc and Xperia Arc S
Found in a couple of stores for 16500-17200. The phones are comparable in performance to the HTC Sensation and Samsung Galaxy R. Upgrading to 4.0 SE was promised "soon in 2012".
Arc in a white case, it seems to me, is very suitable for a girl. Sleek phone.

S
SDSWanderer, 2012-01-30
@SDSWanderer

Nexus S. In my opinion, the price / quality ratio is beyond competition. Well, you can not worry about the update.

K
krovatti, 2012-01-30
@krovatti

My girlfriend, for example, has a Sony Ericsson Xperia PLAY. Gave it to her, because. she wanted to "play around", and she more than liked the design. But there is no Android 4.0 yet. Actually, here he is.
If you need Android 4.0, then I advise HTC Desire S. Here .

S
SFx, 2012-04-09
@SFx

I gave the girl a white galaxy note, I’m glad to a puppy squeal, I got used to it in a week, now I don’t understand how I live with SGS2 and such a small screen ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question