WordPress.org

Support

Support » Plugins and Hacks » Adding functionality to CG-SameCat

Adding functionality to CG-SameCat

  • The CG-SameCat plugin is awesome and full of possibilities. Check out a sample page for my problem: http://leftcoastlifestyle.com/blog/fashion/ya-ya-wheat-canvas-jacket/

    I have created this code in my single post page:

    ‘<?php
    if (function_exists(‘list_posts_of_cat’))
    foreach((get_the_category()) as $cat)
    {
    {
    $catp = list_posts_of_cat(get_the_category(), 10, 0, $post->ID);
    if ($catp)
    {
    echo “<div>”;
    _e(“Recent Finds in “);_e($cat->cat_name . ”);_e(“:”);
    _e($catp);
    echo “</div>”;
    }
    }
    }
    ?>’

    And as you can see, it creates two lists, one for each category, but I’m not smart enough to figure out how to either modify that chunk of code or the plugin code to make it create a list relevant to each category, currently it lists the same related items from the first category under each category heading.

    I am sure this would be of use to a lot of people. Thanks for any ideas guys…

Viewing 5 replies - 1 through 5 (of 5 total)
  • Modify the innards to something like:

    if (function_exists('list_posts_of_cat'))
    foreach((get_the_category()) as $cat)
    {
    $catp = list_posts_of_cat($cat, 10, 0, $post->ID);
    if ($catp)
    {
    echo "<div>";
    _e("Recent Finds in ");_e($cat->cat_name . '');_e(":");
    _e($catp);
    echo "</div>";
    }
    }

    I think that’ll do what you want, though I’m doing this off the top of my head. 😉

    -d
    CHAITGEAR

    Wow, I didn’t expect the man himself to respond! I tried that and variations on it and it either returned no matching posts at all or broke it completely. Any other ideas?

    As I said, that was off the top of my head. I’d have to dig into the code, which isn’t going to happen immediately. If you haven’t heard back from me by the weekend, feel free to ping me at my site.

    -d

    Any luck David? I checked out your site – very nice!

    Bump. I tried working with it some more, no success. Any ideas?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Adding functionality to CG-SameCat’ is closed to new replies.