Search code examples
phpwordpresscategoriespostsdisplayobject

WordPress Posts from category won't display


I use a plugin called "Custom Content Type Manage" this allows me to create a new content type which essentially mimics posts (all done in the name of 'user friendly') This aside, I wrote the following:

<h2><?php single_cat_title( '', true ); ?></h2>
<p>
    <?php 
        $page_id = '5536';
        $page_data = get_page($page_id); 
        print apply_filters('the_content', $page_data->post_content);
    ?>
</p>
<p>
    <?php 
        $category = get_the_category(); 
        $category_id = $category[0]->cat_ID;
        print category_description( $category_id );
    ?>
</p>

<div class="category-list">
    <?php wp_nav_menu(); ?>
</div>

<ul class="leaders-container">
<?php if (have_posts()) : while (have_posts()) : the_post();?>
    <li class="leader-container">
        <?php
            $image = get_custom_field('leader_image:to_image_array');
            $url = get_custom_field('website_url:raw');
            print "<img class='leader-image' src='".$image['0']."'>";
        ?>

        <h2>
            <?php the_title(); ?>
        </h2>
        <?php
            print "</h2>";
            the_content();
            if($url != "#") {
                print "<a class='website-button' href='".$url."' target='_blank'>Visit Website</a>";
            }
        ?>
    </li>

<?php endwhile; endif;?>

What this was doing, was getting the info from the category, and listing all the posts assigned to the category.

In this case, a post was labeled as a "Leader" and a category was their "congregation", so it was listing all the leaders assigned to the congregations.

This is an example of what it should look like http://www.ubmsonline.org/?leader=rabbi-binyamin-sheldrake

However, this only works as it is a direct link from the posts in question

The category on the otherhand, which was working, and did list as many leaders assigned to the category, has now stopped working. http://www.ubmsonline.org/category/ubms-leaders/

As you can see though, its pulling everything across correctly, category description, category title etc, but its just now not showing the posts.


Solution

  • fixed!

    It was to do with a setting that changed on the "Custom Content Type Manager" plugin im using. After alot of research, i stumbled upon the exact problem on the "issues" section of the plugin's FAQ's page.

    https://code.google.com/p/wordpress-custom-content-type-manager/issues/detail?id=594

    Hopefully this might help others.

    In wp-content/plugins/custom-content-type-manager/loader.php the filter mentioned below might be commented, so if you uncomment this add_filter this bug will fix.

    // Enable archives for custom post types
        add_filter('request', 'CCTM::request_filter');
    

    Thanks again for every one's help.

    Andrew