Show category icons on search page (in results)
This topic contains 20 replies, has 3 voices, and was last updated by Guust 6 years, 11 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: categories, Icons, Listing, listings, parent, search page
-
AuthorPosts
-
December 31, 2017 at 11:37 am #411036
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
DavidDecember 31, 2017 at 12:06 pm #411038Hello!
That is not possible out of the box and would require customization.
Please see https://wpgeodirectory.com/docs/customizing-your-style/
December 31, 2017 at 12:09 pm #411039I 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!
December 31, 2017 at 12:15 pm #411040The 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/
December 31, 2017 at 12:35 pm #411041Found 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?
December 31, 2017 at 12:43 pm #411042After you customize the code, you can add it as a code snippet:
December 31, 2017 at 12:55 pm #411043Ok, 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?
December 31, 2017 at 1:03 pm #411044I’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.
December 31, 2017 at 3:47 pm #411049I 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).
December 31, 2017 at 5:53 pm #411061I 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’);
December 31, 2017 at 6:21 pm #411065Hello!
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
December 31, 2017 at 8:58 pm #411077Thank you Alex. I will have a fresh look tomorrow morning!
All the best for the new year!
January 1, 2018 at 12:02 pm #411107Hi David, have a look at https://wpgeodirectory.com/docs/common-code-snippets/#icons
January 1, 2018 at 12:28 pm #411110GUUST!! 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!
January 1, 2018 at 1:36 pm #411112That 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.
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket