[wp-hackers] finding out the top 5 source ( source is a custom taxonomy ), in a given category

Haluk Karamete halukkaramete at gmail.com
Mon Feb 4 02:30:17 UTC 2013


Hi Drew,

I checked the API. It starts out like this;


607	function wp_generate_tag_cloud( $tags, $args = '' ) {
608	        $defaults = array(
609	                'smallest' => 8, 'largest' => 22, 'unit' => 'pt',
'number' => 0,
610	                'format' => 'flat', 'separator' => "\n", 'orderby'
=> 'name', 'order' => 'ASC',
611	                'topic_count_text_callback' => 'default_topic_count_text',
612	                'topic_count_scale_callback' =>
'default_topic_count_scale', 'filter' => 1,
613	        );

I don't think it's got anything to do with any taxonomy but the post_tag.
In my case, there are 2 taxonomies involved. category and source.

On Sun, Feb 3, 2013 at 2:53 PM, Drew <xoodrew at gmail.com> wrote:
> You might look at how wp_generate_tag_cloud() in
> wp-includes/category-template.php goes about finding the term counts and
> assigning font sizes based on those counts.
>
>
> On Sun, Feb 3, 2013 at 2:19 PM, Haluk Karamete <halukkaramete at gmail.com>wrote:
>
>> The client I'm working with have thousands of articles and media (
>> audio/video ) files. To WordPress, all are posted by Author ID 1,
>> which we named as STAFF.
>>
>> All the content though in reality has been created by various people
>> and sources, certainly not by the STAFF.
>>
>> To keep that info ( who created the content or where the source is ),
>> I used a non-hierarchical custom taxonomy called "source". if the
>> source happens to be an institution name I tagged the content by the
>> institution name as follows.
>>
>> Example:
>>
>> source: CNN source: Washington Post
>>
>> And if the source happens to be a person, I used a prefix "by " in
>> front of the name.
>>
>> Example:
>>
>> source: by anderson cooper source: by jon stewart
>>
>> Of course, the content has been tagged and categorized, accordingly.
>>
>> Now, the question is how to effectively find out things like who's the
>> top 5 source's in category XYZ?
>>
>> I don't think this can be pulled by using the wp_query args - by
>> tapping into the advanced tax query's section, cause wp_query args
>> eventually returns posts only. Here we are asking terms in return.
>>
>> One possible way for this is the following
>>
>> take the XYX category go thru all the posts - one by one particularly
>> paying attention to the source data in those posts while going thru,
>> dump each source term id in a temporary table when done with going
>> thru all the posts in that category, switch your attention to the
>> temporary table and get a summary on that table using a get count
>> after a group by and finally get the top 5.
>>
>> but getting all that in a single statement? that ain't my cup of tea yet.
>>
>>
>> http://wordpress.stackexchange.com/questions/84371/finding-out-the-top-5-source-source-is-a-custom-taxonomy-in-a-given-categor
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>
>
>
> --
> -- I've kinda got a thing for WordPress > http://www.drewapicture.com
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list