Show category icons on search page (in results)

This topic contains 20 replies, has 3 voices, and was last updated by  Guust 6 years, 10 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #411036

    David Sirius
    Expired Member
    Post count: 163

    Hi All,

    I have a number of categories and I would like all category icons that are assigned to a place to be shown next to the thumbnail picture (see screenshot).

    I understand showing the categories for each place is in principle possible (see https://www.arbolife.com/en/stores/health-food/?sort_by=rating_count_desc), however, I dont know how and neither how to show just icons instead of text?

    Any help on this would be truly appreciated!

    Many thanks
    David

    #411038

    Alex Rollin
    Moderator
    Post count: 27815

    Hello!

    That is not possible out of the box and would require customization.

    Please see https://wpgeodirectory.com/docs/customizing-your-style/

    #411039

    David Sirius
    Expired Member
    Post count: 163

    I dont think only CSS is sufficient as the content isn’t even there yet. For resizing and aligning the icons next to each other, I agree CSS will be needed.

    @ Guust & Paolo: any view on the above?

    Thank you very much!

    #411040

    Alex Rollin
    Moderator
    Post count: 27815

    The options available are in GD > Place Settings for categories

    Some of our themes display images, so you can open up Supreme, for example, to find the relevent functions for the Detail page.

    And from the codex: https://wpgeodirectory.com/codex/codex/geodirectory_functions/geodir_get_term_icon/

    We have a developer example here that uses the funciton,search for “PHP Mouseover” to find it:https://wpgeodirectory.com/docs/faqs/detail-page/

    #411041

    David Sirius
    Expired Member
    Post count: 163

    Found it! Wouldn’t think it would be in the custom field section! Thanks!

    I have now the categories in text form shown (see screenshot), but how do I pull the respective category icons? I could dig through the files to search for the icon code on the details page (just under the main picture the icons are listed), but where would I insert the code?

    #411042

    Alex Rollin
    Moderator
    Post count: 27815

    After you customize the code, you can add it as a code snippet:

    https://wpgeodirectory.com/docs/useful-plugins/#snippets

    #411043

    David Sirius
    Expired Member
    Post count: 163

    Ok, thanks. I’m not yet too familiar with the full architecture of the plugin and supreme theme, but given your reference to the code snippet, I assume that the content for each place in the search page (i.e. what is shown in my first screenshot) is coded in the functions.php of the supreme-directory folder?

    #411044

    Alex Rollin
    Moderator
    Post count: 27815

    I’m sorry, I don’t understand your question.

    You may examine the Supreme Directory child theme code at your leisure.

    Customizations are outside the scope of our support policy, but if you wish to paste your code here we can take a look and sometimes provide advice.

    #411049

    David Sirius
    Expired Member
    Post count: 163

    I understand Alex, but honestly there are plenty of files across three folders (GD plugin, directory starter, supreme directory) and it’s impossible to find the right place without any help. I’m no professional but typically do know my way around. There is no supporting documentation available to understand the architecture deep enough (>> no the templates page you may refer to is high level and does not help for such a change) and I have spent hours by now browsing through code, it’s really frustrating to constantly hit a wall with the GD code and then facing limitations in the forum here as well and it’s not practicable to hire a developer for any marginal change. Users of the GD plugin should be really able to make layout changes themselves either via available sufficient documentation or support.

    With regards to the question, phrasing it differently: to start making the change (text to icons), I would need to know in which file I have to look to find the code of the details page that calls the icons (screenshot 1). Secondly I would need to understand in which file I have to go to make the amendment by applying similar code from the details page to the search page (screenshot 2).

    #411061

    David Sirius
    Expired Member
    Post count: 163

    I found in listing-listview.php the relevant code for the section on the search page:

    <?php
    /**
    * Called before the post excerpt on the listings view template.
    *
    * @since 1.0.0
    * @param object $post The post object.
    * @see ‘geodir_after_listing_post_excerpt’
    */
    do_action(‘geodir_before_listing_post_excerpt’, $post); ?>
    <?php echo geodir_show_listing_info(‘listing’); ?>

    So the action ‘geodir_before_listing_post_excerpt’ is providing all the custom fields which per my screenshot are categories, and two text fields. However, I cannot find the PHP/HTML file that defines the action. I have manually search in all files in the geodirectory plugin folder and subfolders of functions, templates, and widgets.

    I havent found the HTML code for the details page either (just the general listing-detail.php file pulling the content via actions).

    do_action(‘geodir_add_page_content’, ‘before’, ‘details-page’);

    #411065

    Alex Rollin
    Moderator
    Post count: 27815

    Hello!

    You are on the right track, and I sent you the function before for calling the icons, as well as an example of how it is used. Examples of actions on listings can be found in the forum also.

    This is a customization and outside of support

    https://wpgeodirectory.com/support-policy/

    #411077

    David Sirius
    Expired Member
    Post count: 163

    Thank you Alex. I will have a fresh look tomorrow morning!

    All the best for the new year!

    #411107

    Guust
    Moderator
    Post count: 29970
    #411110

    David Sirius
    Expired Member
    Post count: 163

    GUUST!! You rockstar! Thank you so much!! You wont believe the time I have wasted on this!

    There is only one thing left, which is to structure the icons in a meaningful way:
    I have parent and subcategories. The code now shows all categories (regardless of type) next to each other, which makes sense for no sub cats but doesnt work in this case.
    How would the code to be amended to have the parent categories as text underneath eachother followed by their subcatageories as icons in the same line, basically an ordered list of parent categories with their sub cats next to them?

    As an example, the final output result would be:
    <TEXT>Parent category name 1:</TEXT> Subcategory icon 1.1 Subcategory icon 1.2 …
    <TEXT>Parent category name 2:</TEXT> Subcategory icon 2.1 Subcategory icon 2.2 …
    <TEXT>Parent category name 3:</TEXT> Subcategory icon 3.1 Subcategory icon 3.1 …

    Thank you again!

    #411112

    Guust
    Moderator
    Post count: 29970

    That would not be that easy, and requires too much customization. I suggest you try to find someone to help at https://geodirectoryexperts.com/ if you cannot manage it yourself.

Viewing 15 posts - 1 through 15 (of 21 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount