There are about 70 categories in Drupal 7 with taxonomy. I would like to get list 20 of the most popular(most used), sorted from most popular to the least placed in block.
Dogs (200 Entries)
Cats (120 Entries)
..
Is there a module that has this functionality, or how would you get it done.
You can use tagadelic module.
With a bit of CSS you can change the modules' display to not render popular tags larger then less popular tags.
And with a simple theme-override you can add the amount (200) of usage to the output too.
Related
I have a site using woocommerce, I have imported products from an old oscommerce site, some of the products have several attributes, woocommerce threats those attributes as combinations, the problem is that each product come imported with thousands of combinations and my site crashes.
One example (Not real site):
I have one product with two attributes, color y size,
Colour has Red(+$50), Black(+$150), White ($+30)
Sizes has M(+$25), L(+15),XL(+58)
And you'll have multiple variations, in this case, 9 I think.
Now you have 10 different attributes, each with 20 or 30 possible values.
You'll have thousands of variations, this is what makes the site crash. I need to find a way to code or modify the system queries so this variation are less heavy and have fewer iterations, since if as soon as I try to load the product on the site, my database just dies.
Thank you.
For a WordPress project I'm looking for a better solution to this problem:
The query should get a set of different post_types and taxonomies (like categories), based on the site visitors choice. For example, the user want to get results from normal posts, but also products (from WooCommerce) and other post_types like events and news (both separate post_types. The tricky part is, that the user wants to assign a weight factor to each. So if they select like posts = 1, products = 3, news = 4, they should get a number of posts, three times more products and 4 times more news.
Next step will be to include categories, also with the weight factor, which will make it even more complex, because for posts, I need to query another taxonomy than for products.
The only way I found to solve this, is to run a separate query for each post_type, like fetching 10 items from posts, 30 items from products and 40 from news, to match the weight factors, then combine the results. But this will not scale very well when I need pagination (for example, I want to show 50 entries on the first page, next 50 on second page).
I thought about collecting these single queries into a temporary table, but such a table will be available for the current session only, so it won't help with the pagination (as the temporary table would no longer exist, when the second page is shown).
Does anybody have an idea, how I could approach this task? I would like it according to the WordPress coding standards, so I would like to use WP_Query and the provided filters, because the site is also using geolocating and WPML for translation, so I really would like to avoid writing a low-level query where I have to include all these manually.
I'm not looking for a final solution, just want to collect some ideas.
I am creating an RSS feed for a website I am working on. I read about RSS and it is pretty simple: It is a specially formatted XML file.
However, I could not find information about the following two questions
Is there a limit to the number of entries/items in an RSS feed? Should I have 10 entries only? Or can I go up to 100 for example? What if I have more entries than 100 per day? What can I do?
Can I have pages with each page displaying 10? So for example, www.emample.com/rss/ will give page 1, and www.example.com/rss/2 will give page 2 of RSS, and www.example.com/rss/3 will give page 3, and so on. The reason for this question is the following: If I am restricted to only 10 rss items, what happens if I have 50 items updated to the site since my last RSS update?
Thanks.
Is there a limit to the number of entries/items in an RSS feed? Should I have 10 entries only? Or can I go up to 100 for example? What if I have more entries than 100 per day? What can I do?
Depends on version of RSS used. If you're using the UserLand RSS 0.91 spec, for example, the number of item in a channel should be limited to 15 according to info in the RSS 2.0 spec. If you think of RSS as a format for periodic updates this makes sense—though it can be limiting.
If you look at jekyll-feed RubyGem—which uses Atom and is deployed on GitHub Pages sites—the number of posts is limited to 10. But you can do whatever your want as long as the spec permits.
For example, if you have more than 100 entries per day you're obviously going to want to increase the number and RSS 2.0 (and maybe Atom?) is fine with that. To signify to the RSS user agent the content is updated with a high frequency you can use the Syndication module to output time:
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
(Don't forget to add the XML namespace when using.)
Just keep in mind if you're using the Content module to output the full text of an an article in a CDATASection you're probably going to want to truncate some text if the sections are large.
Can I have pages with each page displaying 10?
Yes, though if you do you should probably have an RSS for your RSS to indicate the pages and use guid without a URL to ensure they're properly identified and deduped by the feed reader. This is also going to depend on the RSS user agent and what your desired results are.
And just for fun here are some modules for RSS 2.0 which make it very extensible:
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
Only use what you need and drop namespaces you aren't using.
Another option is to look at Atom, which is another format read by all modern readers transparently (no one will notice this is Atom or RSS). Atom has pagination as per this RFC.
Generally, though, pagination is not widely used to say the least... so you probably don't need to bother too much!
Whether you pick RSS or Atom, it's useless to make your feeds "too large". Stick to a small-ish number of items, between 10 and 20, depending on how often you publish items.
Also think about implementing PubSubHubbub which is a fairly simple publish/subscribe protocol which will let anyone interested in your content know that a given feed has updated.
RSS 2.0 Specification:
In RSS 0.91, various elements are restricted to 500 or 100 characters.
There can be no more than 15 s in a 0.91 . There are no
string-length or XML-level limits in RSS 0.92 and greater. Processors
may impose their own limits, and generators may have preferences that
say no more than a certain number of s can appear in a channel,
or that strings are limited in length.
In RSS 2.0, a provision is made for linking a channel to its
identifier in a cataloging system, using the channel-level category
feature, described above. For example, to link a channel to its
Syndic8 identifier, include a category element as a sub-element of
, with domain "Syndic8", and value the identifier for your
channel in the Syndic8 database. The appropriate category element for
Scripting News would be 1765.
An RSS file is primarily used to tell subscribers when there's is new content on your site. You would generally set the number of s in your feed to reasonably accommodate the number of pages that change on a regular basis over a certain period.
If you want the SEs to know about your pages then another type of XML file would be suggested; site maps.
Drupal 7 plus Internationalization (won't list all modules as quite a lot!).
I have various dropdowns, including exposed view filters based on taxonomy references. These are all translated perfectly however they are always presented in the order of the taxonomy terms in the default language (English). The following shows what I mean, the English is in order but the Spanish appears in the English order
English Spanish (as is) Spanish (should be)
======= =============== ===================
bike bici bici
book libro coche
business empresa empresa
car coche libro
question is how to get the Spanish sorted in to alphanumeric order? (some of these dropdown have 30 or 40 items in a near random order and look awful!)
edit: incorrect additional information removed
rather embarrassingly I have just located a sort in my own code that causes the above behaviour! (Hangs head in shame and exits stage right)
When I create entries for my RSS feed should I include a full history or just partial?
How many should I go back?
Do rss readers remember entries in the past (before cutoff) if I make it a partial feed?
Thank,
Kevin
Obviously it's impractical to keep a full history in your RSS feed if you have a frequently updated site. Sites like the BBC would end up with RSS feeds several MB long if that were the case.
I generally limit my feed to the last 30-40 posts—people use feeds to stay up to date with the latest news/announcements from a site, so they really don't need to see feed items from 2 months ago. But sites like BBC news seem to maintain feeds around 80 items long.
And I don't think most readers remember past entries. It's sort of assumed that old entries will eventually fall off the feed as new items are added. RSS is for syndication not archiving.