• Resolved blue522

    (@blue522)


    Hi FPS,

    Been staring at code for hours and need your clarity…

    I used CCTM last January to create CCT “players” for a team. At the time, Summarize Posts was in the process of being absorbed into CCTM, so I avoided it.

    Each player has a page. There is also a players page that shows some brief stats for each player, headshot, link to their personal page.

    Ran a bunch of updates today (WP 3.4.2, CCTM 9.6.1) and now my players page is blank.

    According to Posts>Categories, I have 7 players created and categorized as “players” (category 14). But when I call:

    <?php
    $args = array( 'category'=>14, 'numberposts'=>-1 );
    $playerposts = get_posts( $args  );
    echo count($playerposts);
    ?>

    I get “0”.

    When I change the category to ’18’ (regular news post), I get an accurate count.

    Are CCTM categories the same as post categories? The above php worked prior to upgrade.

    Thanks for any advice,

    blue522

    http://wordpress.org/extend/plugins/custom-content-type-manager/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter blue522

    (@blue522)

    Switched from ‘category’=>14 to:
    ‘post_type’=>’players’

    and all is good now. posting here for others.

    Plugin Contributor fireproofsocks

    (@fireproofsocks)

    Thanks for sharing your solution. I think you may have gotten tripped up by the differences between taxonomies (i.e. categories) and post-types. They both represent valid ways of organizing your data, but the mechanics involved in searching for that data is vastly different. One of the reasons I wrote SummarizePosts (now included in CCTM) was because WP’s inputs for its native get_posts() and WP_Query() et al were notoriously inconsistent and not as flexible as I wanted (e.g. sometimes they’re only usable inside the loop).

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Custom Content Type Manager] CCTM posts have category, but not called into array’ is closed to new replies.