E
E
Eugene Simon2018-04-25 22:28:58
WordPress
Eugene Simon, 2018-04-25 22:28:58

How to insert a function into a Wordpress function?

Hi friends!
I'm picking a template for wordpress and can't figure out how to do it right. Not strong in php.
The situation is this:
this code

function directory_subcategory(){
  global $wpdb,$wp_query;
  $term_id = $wp_query->get_queried_object_id();
  $taxonomy_name = CUSTOM_CATEGORY_TYPE_LISTING;
  do_action('tevolution_category_query');
  $featured_catlist_list =  wp_list_categories('title_li=&child_of=' . $term_id .'&echo=0&taxonomy='.$taxonomy_name.'&show_count=0&hide_empty=1&pad_counts=0&show_option_none=&orderby=name&order=ASC');
  if(is_plugin_active('Tevolution-LocationManager/location-manager.php'))
  {
    remove_filter( 'terms_clauses','locationwise_change_category_query',10,3 );
  }
  if(!strstr(@$featured_catlist_list,'No categories'))
  {
    echo '<div id="sub_listing_categories">';
    echo '<ul>';
    echo $featured_catlist_list;
    echo '</ul>';
    echo '</div>';
  }
}

generates a list of categories in this style
<ul>	
  <li class="cat-item cat-item-36"><a href="#" title="...">Ссылка</a>
        <li class="cat-item cat-item-39">.....
</li>
</ul>

It is necessary to insert this into the code in order to get the output
<?php the_field('hero_image'); ?>
<ul>	
  <li class="cat-item cat-item-36">
           <img src="#"/>
           <a href="#" title="...">Ссылка</a>
        <li class="cat-item cat-item-39">.....
</li>
</ul>

Tell me plz....

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Max Medar, 2018-04-26
@Comers

Hello.
There are different ways. You can just go through the $featured_catlist_list variable with a regular expression and add your own piece of html. It is possible to modify the walker which initially builds the html for wp_list_categories(). Example - www.draghici.net/2016/04/25/wordpress-adding-bootstrap

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question