Viewing 14 replies - 1 through 14 (of 14 total)
  • Hi.
    I don’t see any problems in the page you shared.
    Did you already figure this out?

    Thread Starter JoyceD6

    (@joyced6)

    No. The collapsing categories is working fine, but I think something in that code is breaking my ability to post the_content or the_excerpt of the main blog page since it was there before I put the collapsing-categories code in. Any idea about that? Here’s the code for callapsing-categories that I put on archives.php which give me the left side bar information for all post pages (I didn’t set it up this way – someone else created this site):

    `<h6>Topical Categories</h6>
    <div class=”categories-list”>
    <?php
    echo “<ul class=’collapsCatList’>”;
    if (function_exists(‘collapsCat’)) {
    collapsCat(‘animate=1&catSort=ASC&expand=4&showPostCount=true&expandCatPost=0&PostTitleLength=0&debug=true’);
    } else {
    wp_get_categories(”);
    }
    echo “</ul>”;
    ?>
    </div>

    <h6>Archives</h6>
    <div class=”archive-list”>

    <ul>
    <?php
    wp_get_archives(‘type=monthly&format=html&show_post_count=false’);
    ?>
    </ul>
    </div>`

    http://wordpress.org/extend/plugins/collapsing-categories/other_notes/

    Probably you have various options wrong.

    PostTitleLength is most probable postTitleLength. 0 is default value anyway so there is no need to specify that option.

    catSort is used to choose what you what to sort by. So possible values are like “catId”, “catSlug”, “catName”… It is not intended to be used as the order of sorting. For order of sorting the variable reads catSortOrder that can have “ASC” or “DESC” as value.

    I don’t see animate as one of the options though in the example on that documentation page is shown too. Probably the example at the bottom of that documentation is outdated.

    Don’t know if that would solve the problem but at first glance that’s not correct code.

    Thread Starter JoyceD6

    (@joyced6)

    Thanks for the help.

    I removed the PostTitleLength, catSortOrder, and “animate=1&”. It didn’t hurt the left column view or the results view, but it didn’t improve the problem of the excerpts not showing up.

    Now the code is:

    <h6>Topical Categories</h6>
    <div class="categories-list">
    <?php
    echo "<ul class='collapsCatList'>";
    if (function_exists('collapsCat')) {
      collapsCat('expand=4&showPostCount=true&expandCatPost=0&debug=true');
    } else {
      wp_get_categories('');
    }
    echo "</ul>";
    ?>
    </div>
    
    <h6>Archives</h6>
    <div class="archive-list">
    
    <ul>
    <?php
    wp_get_archives('type=monthly&format=html&show_post_count=false');
    ?>
    </ul>
    </div>

    Also, the debugger info is listed below, but I don’t know how to correct the problems:

    Total Functions:1
    Total Arguments:2
    Total Files:0

    wp-content/plugins/wp-blocks/wp-blocks.php:53 – wp_tiny_mce is deprecated since version 3.3! Use wp_editor() instead.

    wp-admin/includes/plugin.php:1008 – Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead.

    wp-admin/menu-header.php:112 – Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead.

    The bugs are not the problem, though. It has to be in the categories-list area as I just removed it and the posts come back: http://ridingthewave.net/kowabunga-blog/

    Thread Starter JoyceD6

    (@joyced6)

    I tried:

    <h6>Topical Categories</h6>
    <span class="categories-list">
    <?php
    echo "<ul class='collapsCatList'>\n";
    if (function_exists('collapsCat')) {
      collapsCat('expand=4');
    } else {
      wp_get_categories('');
    }
    echo "</ul>\n";
    ?>
    </span>
    
    <h6>Archives</h6>
    <div class="archive-list">
    
    <ul>
    <?php
    wp_get_archives('type=monthly&format=html');
    ?>
    </ul>
    </div>

    and that messed up, too, it looks like this:
    http://ridingthewave.net/ridingthewave-category-no-excerpt.jpg
    (note: category left side links with the body having post titles but no excerpts)

    but if I remove the category code entirely, then the site looks like this:
    http://ridingthewave.net/ridingthewave-no-category-excerpt.jpg
    (note: no category left side links with the body having post titles and one excerpt showing)

    If I understand correctly you say there is a problem on the center of the page, where the post listing is shown and you are almost sure the problem comes from collapsing categories so you only show us that code.

    I think we would need to see the code that outputs those posts in the middle.

    Are you sure you didn’t touch the template file that outputs that part of the page? The Loop seems to work correctly as the title, date and read more link of each post is being displayed, so looks strange the_excerpt() not working in The Loop.

    I suppose it is because you are doing tests but makes no sense to change the categories-list div into a span.

    Thread Starter JoyceD6

    (@joyced6)

    Yes, I realize changing the div to span didn’t make sense, but I was grasping at straws. I think it has to be that archive code since the middle code changes when I have the code for the category list in the left column or not.

    I have another request in on this problem for loop.php and I posted that code and the index page code there:
    http://wordpress.org/support/topic/loopphp-editing-for-main-blog-page-help-needed

    I hope you can glean something from that. I’m really at a loss to figure out the problem. I so much appreciate your effort to help!

    Sorry but I understand nothing about the other post. You first show a code on a supposed loop.php file. Later you show the code of an index.php file that makes no use of that loop.php file and has this snippet.

    <div id="col-2">
    <h1><?php the_title();?></h1>
    
    <?php
    
    if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <p><?php the_content('Read more...'); ?>
    <?php endwhile; else: ?>
    <?php _e('Sorry, no posts matched your criteria.'); ?>
    <?php endif; ?>
    
    </div>

    And on this snippet at least there is an error, the_title() outside The Loop. I really can’t see how that index.php matches the output on your site.

    Are you really sure you know where the output comes from? Which are the files you have in your theme folder?

    Thread Starter JoyceD6

    (@joyced6)

    The index.php is in the last post on that thread. It has the archive template in col-1 and the center of the page in col-2. I’ll repost index.php here:

    <?php get_template_part('./template/header');?>
    <body class="inner-page">
    <div id="outer-wrapper">
    <?php get_template_part('./template/navigation');?>
    <div id="wrapper">
      <!--header-->
      <div id="header">
      <!--blog title -->
      <div class="blog-title">
        <img src="<?php bloginfo('template_directory');?>/images/new/kowabunga_masthead.jpg" alt="" />
        </div>
      <!--/blog title -->
      </div>
      <!--/header-->
      <!--content-->
      <div id="content">
      <!--sidebar left -->
        <div id="col-1">
    
    <?php get_template_part('./template/archives');?>
    
        </div>
        <!--/sidebar left -->
        <!--page -->
        <div id="col-2">
        <h1><?php the_title();?></h1>
    
        <?php 
    
        if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <p><?php the_content('Read more...'); ?>
     <?php endwhile; else: ?>
    <?php _e('Sorry, no posts matched your criteria.'); ?>
    <?php endif; ?>
    
        </div>
        <!--/page -->
    <?php get_template_part('./template/sidebar-right');?>
        <div class="clear"></div>
      </div>
      <!--/content-->
    <?php get_template_part('./template/footer');?>

    I agree there’s no text “Read more…” so that’s why I think the loop is inserting into this section as it has the code for “read more >>” which is what appears there. I don’t see it called there as other templates are called in that code, but I’m not sure how it works; that’s part of my problem. The template for loop.php:

    <!--post -->
        <div class="post">
        <a href="<?php the_permalink();?>"><h6><?php the_title();?></h6></a>
        <div class="meta-post">Posted on <?php echo get_the_date();?> </div>
    <?php the_content(); ?>
    <p><a href="<?php the_permalink();?>">read more >></a></p>
       </div>
       <!--post -->

    My list on the Templates page is:
    Theme Functions
    (functions.php)
    home.php
    Main Index Template
    (index.php)
    page-18.php
    Page Template
    (page.php)
    Single Post
    (single.php)
    add-this.php
    archives.php
    Footer
    (template/footer.php)
    Header
    (template/header.php)
    logo.php
    loop-single.php
    loop.php
    navigation.php
    post-comments.php
    sidebar-left.php
    sidebar-right.php
    Styles
    Stylesheet
    (style.css)

    The home.php is for the home page of the site and I don’t think it affects the blog pages.

    I downloaded the site to my Dreamweaver to do a text search of the source code of the entire site and could only find template/loop in page-18.php so I did a search of page-18 and found nothing. Here’s the code for page-18, though I don’t know how it’s called:

    <?php get_template_part('./template/header');?>
    <body class="inner-page">
    <div id="outer-wrapper">
    <?php get_template_part('./template/navigation');?>
    <div id="wrapper">
      <!--header-->
      <div id="header">
      <!--blog title -->
      <div class="blog-title">
        <img src="<?php bloginfo('template_directory');?>/images/new/kowabunga_masthead.jpg" alt="" />
        </div>
      <!--/blog title -->
      </div>
      <!--/header-->
      <!--content-->
      <div id="content">
      <!--sidebar left -->
        <div id="col-1">
       <?php get_template_part('./template/archives');?>
        </div>
        <!--/sidebar left -->
        <!--page -->
        <div id="col-2">
    
        <?php
    wp_reset_query();
    
    function filter_where($where = '') {
    //posts in the last 30 days
    $where .= "AND post_date > '" . date('Y-m-d', strtotime('-30 days')) . "'";
    //posts 30 to 60 days old
    //$where .= " AND post_date >= '" . date('Y-m-d', strtotime('-60 days')) . "'" . " AND post_date <= '" . date('Y-m-d', strtotime('-30 days')) . "'";
    //posts for May 8 to May 16, 2008
    //$where .= " AND post_date >= '2008-05-08' AND post_date < '2008-05-16'";
    return $where;
    }
    
    add_filter('posts_where', 'filter_where');
    $query = query_posts('post_type=post');
    $last_days = count($query);
    
    if ($last_days  > 0) {
        wp_reset_query();
        add_filter('posts_where', 'filter_where');
        query_posts( array( 'post_type' => 'post') );
    
    } else {
        wp_reset_query();
        remove_filter('posts_where', 'filter_where');
        query_posts( array( 'post_type' => 'post') );
    
    }
    
        if ( have_posts() ) : while ( have_posts() ) : the_post();
        get_template_part('./template/loop'); ?>
        <?php endwhile;
        echo "<br/>";
        //wp_pagenavi();
        else: ?>
        <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
        <?php endif; ?>
    
        </div>
        <!--/page -->
    <?php get_template_part('./template/sidebar-right');?>
        <div class="clear"></div>
      </div>
      <!--/content-->
    <?php get_template_part('./template/footer');?>

    I appreciate your continued time spent trying to figure this out with me. Any suggestions will be appreciated.

    That seems more probable the template being used on that page and though really it looks a little mess what it is done there it should work. Really it would be much better to support widgets on the theme.

    Anyway indeed it seems collapsing categories is affecting the posts data that are not showing many of the fields, like the posts content, excerpt…

    I think I found the problem and it is on collapscatlist.php line 169 where there is a call to get_permalink in which the whole post object is used as parameter. Using the ID as parameter instead solves the problem. So changing line 169 of collapscatlist.php from:

    "'><a " .  "href='".get_permalink($post2).

    to:

    "'><a " .  "href='".get_permalink($post2->ID).

    should fix this.

    Don’t ask me why that weird side effect is happening. I don’t know because at first it is correct code to send the $post object as parameter to get_permalink function.

    Anyway take in mind that collapse categories is meant to be used inside a widget, the collapse/expand feature doesn’t work if you don’t use the widget so you would need to code it yourself or you can fool collapse categories to think it is part of a widget like this:

    echo '<ul id="widget-collapscat-nowidget-top" class="collapsing categories list">';
    collapsCat(array(
      'expand'        =>0,
      'useCookies'    => false,
      'expandCatPost' => true,
      'showPosts'     => true,
      'accordion'     => true,
      'number'        => 'nowidget'
    ));
    echo '</ul>';

    This way the collapse/expand effect will work. You must tweak anyway the CSS because the styling doesn’t work outside the widget. That should not be difficult.

    Thread Starter JoyceD6

    (@joyced6)

    I don’t know why I didn’t notice this immediately after you posted it, but it did work. Thank you.

    manfer

    I have just come across this thread and it has solved the same problem I was having , your patience and skill are to be commended…

    Thanks

    Wayne
    [ Signature moderated. ]

    Boris

    (@ispacecrusader)

    @manfer: You’re a genius! I’ve been having the same problem, but I wasn’t proficient enough in PHP to figure out what was going wrong. Finally I’ve got it solved now. Thank you!!

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Collapsing Categories: messing up blog home page’ is closed to new replies.