Sort div based on value in database in PHP - php

So I have a website where I have companies listed. I have a category section where I put some categories who I may think are popular, you can see a picture of it below. When people are searching for a company on the website or click one of these categories, that data is saved in a database. So the search history is saved. What I am trying to achieve is to know which category is more popular based on the values that are saved in the database and sort the category section. For example if restaurants is more popular in the database it should come first in the category section. I searched for this on google but I couldn’t find an answer. How can I achieve this in PHP?

Related

Display Team Member Categories on Individual Team page

I am working on a website for a show that I am producing called Puppet Playlist. I am trying to find a way to display the categories that each team member is added into on their own individual pages.
Think of it this way, each artist will work on specific shows. Each show is it's own category. I have on each show page (portfolio posts) a team-member display which shows whatever team members are in that specific category.
What I'm hoping for, is a way to display the shows that the team member has worked on (meaning I want to display a list of the categories that the team member has been added to).
I've seen all of the get_the_categories and get_the_terms, but none seem to be working on my site, and it might partially be because I have no idea where to post them to. I'm using the Joyn Theme by Swift Ideas.
I would like a clear explanation of what to add and where to add it to in order to get the categories to display properly. I'm familiar with code, but am definitely not a coder/developer.
Thanks!

Navigating through custom post types in WordPress

I want to redesign my website using WordPress (as CMS) and Bootstrap (as front-end).
Now, I've been pretty successful at doing so, but I have one specific problem.
I have a tutorial website and I want the navigation structure to look like this :
If the user is on my 'website-name/tutorials' then display to him all of the tutorial series titles in an unordered list (so for example C++, XHTML and CSS - but not individual tutorials in each series)...
If the user clicks on some specific serie, then display an ordered list of the elements (so, if he clicks C++, then URL will be 'website-name/tutorials/cplusplus' and he will be able to see all of the tutorial in an ordered list).
If the clicks on one specific tutorial, then the URL goes (for example) 'website-name/tutorials/cplusplus/installing-the-program' and user gets all the content related to the tutorial.
Now, I have been experimenting with this and concluded that the best solution is to create custom post type named "Tutorial" and then make every single tutorial that post type.
However, since on 'website-name/tutorials/cplusplus' I want to display the list of tutorials in "C++" tutorial series and on 'website-name/tutorials' I want to display only the tutorial names, I don't know how to do that.
I tried to do that using Hiearchical posts (so, for example, I made a parent post named "C++" and it's children were all of the tutorials in the C++ serie).
However, I have a problem with that, because my C++ tutorial series has 100 tutorials, but it shows me 101 list elements (I made the website display all the custom post types in an ordered list), with the first one on the list being C++ (the parent post).
So, I'd like to echo the series name only on the 'website-name/tutorials' not on the beginning of the list.
I researched and people seem to use archive in custom post types, rather than parent/child system for this kind of navigation.
I just wanted some of the WP experienced users here to tell me, which is the better solution for my problem? Dealing with these parent/child problems or switching from parent/child posts to archive posts?
If I understand fully perhaps using standard posts and categories will do the trick? Your '/tutorials/' page can display the full list of all posts and when a user clicks on a specific category (e.g. C++) only the relevant posts will display.
You can use the following code to list posts of a specific category:
<?php query_posts( 'cat=20' ); ?>
Changing "20" with the chosen category ID.
Hope this helps!

Blog Post Associated with category

Hi I have been trying for a few hours now but I can't seem to figure it out for myself, I'm using the fish pig word-press plugin and I want to display word press blog post Associated with Magento category. There is a tab in the magento back end for doing so but I can't get it to display in the front-end
<action method="setEntity"><type><![CDATA[cms_page]]></type></action>
I think the key to getting it to display is the "set Entity" but I can't get it right.
I have tried to change it to many things but it still ain't working
If you're trying to display associated blog posts on the Magento category page, this isn't possible. At the time of writing, associating a blog post with a Magento category is just a quick way to associate that post with all of the products in the category.
I will be working on an update in the future that will allow you to show associations on the category page, but currently this would require some custom development on your part. To do this, you would need to query the database to extract the post/category relationships and then load a post collection based on that.

wordpress Including categorys in search results

I am trying to include categories in search results I've been google-ing for hours now with no solution.
Now by including categories i dont mean search in a certain category, i mean lets say i have a bicycle store and have many companies included in the site. A user searched for BMX mountain cross.. for example. it will return the category BMX first(by clicking you'll be sent to category page) and the posts related to the search term like wordpress normally does.
Anyone has any clue or could point me to the right direction?
This plugin should do the trick
http://guff.szub.net/source/search-catname.php

Drupal route based node content

I'm new to Drupal and have a basic question which I cannot find a good answer to. I am trying to dynamicly determine the contents of my website based on a selection made by the user and keep the selection displayed in the routing for SEO purposes.
It's a website for a Restaurant with multiple franchises.
What i'm trying to do is the following:
The user visits my website and gets a splash screen presented with the available franchises or a textbox to enter his postalcode
Upon selecting he enters the main website with the navigational structure adapted to the selected franchise. For example: domain.com/city/, domain.com/city/menu, domain.com/city/menu/dishes, domain.com/city/contact, ...
The contents of all nodes are based upon the city the user selected. Some franchises have extra nodes which should be displayed in the main navigation aswell.
What I have thought about so far is to try to accomplish this with taxonomy but I really have no idea where to start. Parts of the nodes will be the same for all franchises other parts will be different. Menu item prices will also be different.
This is the first website i'm building using Drupal so any advice is welcome.
Thanks!
It will be impossible to explain it all here but yes it is possible to select your content based on user input in Drupal. You will need to look into Views & Panels.
In Views you can use arguments to narrow to a specific taxonomy. With Panels , an argument can be retrieved fron the URL and passed to the Views in order to display the results.
There are a lot of resources available, Merlin of Chaos, the author of the Views & Panels modules has written a book about it. There are video tutorials online. Your best bet is to start with drupal.org.

Categories