WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Use category to distinguish items

[Resolved] Use category to distinguish items

  • creeser
    Participant

    @creeser

    My client wants to aggregate multiple fields, but still be able to differentiate the source. I think they want me to create a legend, or perhaps color code the items.

    My plan is to use categories to achieve this. For instance, if I create a “news” category, I want to add the class “news” to the output. Is there something I can use in the template to get the category of each item?

    Thank you for a great plugin!

    http://wordpress.org/extend/plugins/wp-rss-multi-importer/

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Allen
    Member

    @amweiss98

    How about this…can you just create a page, given it a heading that says News, then put in the feeds with the category News? If not this, how would you like the layout to be? That could be done with a template.

    creeser
    Participant

    @creeser

    I worded my question really badly… let’s say a have three rss categories (A, B, C). As I output the rss items, I want to echo the category they are in, so I can style them differently. For instance:

    $readable .= '<span class='.$items["category"].</span>

    But items[“category”] doesn’t work. Is there something else I can try?

    Plugin Author Allen
    Member

    @amweiss98

    oh..ok, if you want to put 3 categories on the same page, there are two ways to do this:

    Segregated: Have 3 headings for each category on the page with 3 shortcodes (1 for each shortcode).

    Mixed: It seems this is what you want, where they all get mixed together but there is an indicator of what category they are in. If this is what you are looking for, it’s doable, but would have to be in an update as there is still some programming involved.

    creeser
    Participant

    @creeser

    Yes, I’m looking for a mixed solution. I told the client it may not be possible. They will live with three heading if they have to. Thanks for looking at this for me.

    Plugin Author Allen
    Member

    @amweiss98

    ok..I’m about halfway there to getting you what you want (need to find a quick function to translate ids into names), but may have something working by the next update (end of this week).

    creeser
    Participant

    @creeser

    Really? Awesome!!! Donation coming your way 🙂

    Plugin Author Allen
    Member

    @amweiss98

    Thanks..ok, I have it working now…thanks for the donation. Now, since not everybody wants this, I’ll have a variable that you’ll need to run through a function, like this

    getCategoryName($items[“mycatid”]);

    and you can use that to place and style the category like:

    $readable .= ‘<span class=’yourclass’>’.getCategoryName($items[“mycatid”]).</span>
    After I launch this let me know if you need help getting the template working and then be sure to save template (using the template panel) so it’s available after future updates.

    Plugin Author Allen
    Member

    @amweiss98

    actually, if you tell me where you want this to go, I can put it there in the code and then you just need to stylize it using css…so would it be next to the source, above the title, next to the date, or where?

    creeser
    Participant

    @creeser

    I’ve already created a custom template. I just need to know where to create the variable (which file) and how to reference it in my template.

    Plugin Author Allen
    Member

    @amweiss98

    well, at this point, what I have is:

    if ($showcategory==1){
    $catClassID=’classID’.$items[“mycatid”];
    $readable .= ‘ <span class=”categoryname ‘ .$catClassID.'”>Category: ‘.getCategoryName($items[“mycatid”]).'</span>’;
    }

    but this will require the updated version of the plugin since it relies on functions and other things. $showcategory is simply an option variable since I’ll probably add this as an option. Also I have 2 classes (categoryname and $catClassID which is unique to the category.

    creeser
    Participant

    @creeser

    I can wait for an updated version. My site is in development for another few weeks. Thanks again! I really appreciate it.

    Plugin Author Allen
    Member

    @amweiss98

    If you’d like, I can give you the code right now to try this out….still working on some things, but it should work for you. Let me know if you want and send a message to me by going here:

    http://www.allenweiss.com/contact

    Plugin Author Allen
    Member

    @amweiss98

    This will be an option in the next version.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘[Resolved] Use category to distinguish items’ is closed to new replies.