Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

253
Views
Obtenga categorías de eventos en Wordpress Events Calendar Pro Plugin

Estoy usando el complemento Events Calendar Pro ( https://theeventscalendar.com/product/wordpress-events-calendar-pro/ ) y necesito obtener todas las categorías para cada evento.

single_cat_title() y get_the_category() pero no son lo que necesitaba.

En realidad, la función single_cat_title() muestra solo la primera categoría y get_the_category() devuelve una matriz vacía.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Puede usar el siguiente código para obtener detalles de cada término.

 $cats = get_the_terms( $post_id, 'tribe_events_cat' ); $term = get_term( $cats[1], $taxonomy ); // Getting the 2nd term item $name = $term->name; //Getting names of terms

Más detalles en https://codex.wordpress.org/Function_Reference/get_term .

Déjame saber si tienes más preguntas.

over 4 years ago · Santiago Trujillo Report

0

Probé single_cat_title() y get_the_category() pero no son lo que necesitaba.

La función get_the_category() recupera categorías predeterminadas, categorías de publicaciones. Como las categorías definidas por el complemento Events calendar pro no son predeterminadas, debe usar la función get_the_terms().

En la función get_the_terms(), debe pasar post_id como primer parámetro y taxonomía/nombre de categoría.

Entonces, para terminar, puede probar el siguiente código: -

 $event_cats = get_the_terms( $post_id, 'tribe_events_cat' )

Avísame si necesitas más asistencia...

over 4 years ago · Santiago Trujillo Report

0

Puede intentar hacer una copia de event.php a través de la siguiente ruta:

[tu-tema] /tribe/events/v2/list/event.php

y luego escribe lo siguiente allí:

 <?php foreach (get_the_terms(get_the_ID(), 'tribe_events_cat') as $cat) { echo $cat->name; } ?>

Y luego póngalo en span/p y diseñelo.

Inspirado en: https://wordpress.stackexchange.com/questions/220511/correct-use-of-get-the-terms

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!