Forum Replies Created

Viewing 8 replies - 16 through 23 (of 23 total)
  • Forum: Plugins
    In reply to: get_permalink($category)
    Thread Starter nicksoper

    (@nicksoper)

    bump. This would be useful if anyone has figured it out.

    You could always add an image to the profile section of WordPress using “cimy-user-extra-fields”, then you could display the author image in your comments if the user is an author/admin.

    I believe it’s something like this:
    <?php echo get_cimyFieldValue($author->ID, 'PHOTO'); ?>

    Forum: Plugins
    In reply to: is_child_of_category
    Thread Starter nicksoper

    (@nicksoper)

    Resolved. Here is the solution for is_child_of() or is_child_of_category

    After looking through various posts and examples I found this forum thread in the wordpress support forum, and someone linked to the documentation around this topic which is in the codex documentation section here.

    As for my solution, this is what I ended up with:

    <?php
    if (in_category(10) || post_is_in_descendant_category(10)) {
    wp_list_categories('orderby=id&show_count=0&title_li=&use_desc_for_title=0&child_of=10');
    }
    ?>

    So I will have to add each a conditional statement for each parent (ancestor) category, but all the child/sub categories will automatically populate the list with links of the subcategories in the parent category, which is more important than the top level categories changing that much.

    Note: for post_is_in_descendant_category() to work you will need to add the function to your functions.php file or include is. You can copy paste that code from the codex documentation on this page http://codex.wordpress.org/Template_Tags/in_category#Testing_if_a_post_is_in_a_descendant_category.

    Forum: Plugins
    In reply to: is_child_of_category
    Thread Starter nicksoper

    (@nicksoper)

    I found this code that gets the parent category ID, any tips on how to alter it to get the TOP level parent category?

    <?php
    $category = get_the_category();
    $parent = get_cat_name($category[0]->category_parent); //make this line go to the top level category?
    if (!empty($parent)) {
    echo '&raquo; ' . $parent;
    } else {
    echo '&raquo; ' . $category[0]->cat_name;
    }
    ?>

    Forum: Plugins
    In reply to: is_child_of_category
    Thread Starter nicksoper

    (@nicksoper)

    Hi Michael,

    Thanks for the snippet. My internet was being slow (due to a national network issue here in South Africa) and you actually replied BEFORE my page reloaded. 😮

    I managed to hack this bit of code that works, but (it is still early here so my brain is fuzzy), I was wondering how I can make it a bit more flexible for other categories.

    <?php
    // in category template, test if queried category is child descendant of another category
    
    if (is_category()) {
    
    $parent = 13; //it would be great if this was a variable of the current parent category
    
    $categories = get_categories('include='.get_query_var('cat'));
    
    if ( $categories[0]->category_parent == $parent ||  is_category($parent)) {
    
    wp_list_categories('orderby=id&show_count=0&title_li=&use_desc_for_title=0&child_of='. $parent);
    
    }
    }
    ?>

    At the moment it works if you are in Category 13 or one of it’s child, but I have several other categories that need the same functionality. eg. How could I make this snippet work if are in say category 20 or one of its childs, and do the same thing?

    Perhaps you could get_parent_category, then parse that into the $parent variable?

    Would it be possible to assist with another amazing code snippet? Sorry if this seems trivial.

    Thread Starter nicksoper

    (@nicksoper)

    This is kinda whacky, but after installing the above plugin, the de-activating it seems to have stopped the formatting. So it’s either something to do with:
    – Switching from Safari to FF
    – Upgrading to 2.8
    – Physically re-formatting all of the text that had all the rogue html (I’m talking random divs, spans, and strongs everywhere)

    Additionally we are deleting everything from each post, and pasting the content back in as plain text, and formatting doesn’t appear to be in anymore.

    Not sure if it’s solved, but I’ll close this solitary thread anyway.

    Thread Starter nicksoper

    (@nicksoper)

    The above example link appears to be working now, but a new post has the problem of no formatting.

    http://www.mifireport.com/2009/06/kiva-a-different-way-to-microlend/

    Thread Starter nicksoper

    (@nicksoper)

    The plugin does indeed take out the formatting, but it takes out ALL the formatting, including links 🙁

    I don’t think that the formatting was being inputted on the fly, because after saving the post the formatting would appear in the write panel once saved.

Viewing 8 replies - 16 through 23 (of 23 total)