WordPress.org

Forums

Custom Content Type Manager
after upgrading orderby on posts not working anymore (12 posts)

  1. jarnoschi
    Member
    Posted 3 years ago #

    first of all: thanks for developing this really useful plugin!

    the problem: i had running a content structure with two custom post types, each of them sorted by a custom query (1. orderby="rand" , 2. orderby="ASC",order="title").

    it worked fine until upgrading to the newest plugin-version 0.9.4.1-pl, now all posttypes are sorted by default (creation date), "orderby" has no effect anymore.

    i would be very thankful for any help, how to solve this issue.

    regards

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

  2. jarnoschi
    Member
    Posted 3 years ago #

    i found a quick-solution for this by myself.

    paste:

    remove_all_filters('posts_orderby');

    in the functions.php to have the sort workin again.

  3. fireproofsocks
    Member
    Plugin Author

    Posted 3 years ago #

    Hmmm... interesting. Thanks for pointing this out. I'm still wrapping my brain around WP's filtering action. I should post this as a feature request in the bug tracker.

  4. fireproofsocks
    Member
    Plugin Author

    Posted 3 years ago #

    Could you give me the exact steps to reproduce the behavior your were seeing? I'm trying to write up a bug report, but I'm not sure how to reproduce the problem.

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

    Thanks!

  5. jarnoschi
    Member
    Posted 3 years ago #

    sure.

    i just reproduce the problem with a clean setup, this are the steps:

    -> start with clean wp version 3.2.1
    -> install > Custom Content Type Manager : Version 0.9.3.3
    -> create cpt: "artists"
    -> create 3 artists posts, title: a, b, c
    -> put this snippet on the homepage (index.php in twentyeleven theme):

    <?php
    // show randomly 3 posts of c_p_t 'artists'
    // set the query
    $query = array (
    'posts_per_page' => 3,
    'post_type' => 'artists',
    'orderby' => 'rand',
    'order' => 'title'
    );
    // loops
    $queryObject = new WP_Query($query);
    if ($queryObject->have_posts()) : ?>
    <?php while ($queryObject->have_posts()) : ?>
    <?php $queryObject->the_post(); ?>
    <h2><?php the_title(); ?></h2>
    <?php endwhile; ?>
    <?php endif; ?>

    -> watch behavior of the posts while reloading the site (should be sorted randomly)

    -> auto update Custom Content Type Manager : Version 0.9.4.1-pl.

    -> check sorting of posts again > sort stopped working (

    -> helper: put "remove_all_filters('posts_orderby');" in functions.php

    actually, i am not sure if this workaround completely solves the problem, as well the category pages for the custom content post type + pagination seems to not working properly.

    greetz!

  6. fireproofsocks
    Member
    Plugin Author

    Posted 3 years ago #

    Thanks! This is very helpful.

    You could try using my other plugin: Summarize Posts http://wordpress.org/extend/plugins/summarize-posts/

    It does a better job at retrieving posts that WP does in my opinion. It does support a "random" search ordering and pagination.

    You could also edit the code in the CCTM plugin. Comment out the line in the loader.php that says this:
    add_filter('posts_orderby', 'CCTM::order_posts');

    That was added to make the posts sort, but it seems it's not letting you change it's behavior. I would have thought that adding
    remove_all_filters('posts_orderby');

    would have prevented this code from running, but I need to look into it further.

  7. jetlej
    Member
    Posted 3 years ago #

    This problem extends to BBpress forums, topics and replies as well. They are all out of order when CCTM is activated.

  8. fireproofsocks
    Member
    Plugin Author

    Posted 3 years ago #

    jetlej, I'm not sure what you're referring to with regards to the BBpress forums. If people are having problems with the CCTM plugin, they should be posting here in this forum or filing a bug in the bug tracker -- I put links inside the plugin and on the plugin's page so it'd be easy to find. I can't do any fixing until I know what the problem is and how to reproduce it.

  9. jetlej
    Member
    Posted 3 years ago #

    The order of forums, topics and replies in the BBpress plugin is wrong when this plugin is activated. The code change suggested above fixes the issue. Just letting you know in case that helps somehow. Cheers :)

  10. fireproofsocks
    Member
    Plugin Author

    Posted 3 years ago #

    Ok, that's somewhat helpful. What's the link to plugin? There are several different BBpress plugins, so I need to know specifically.

    I think what should be done is that the sorting order should be configurable in the Settings tab.

  11. jetlej
    Member
    Posted 3 years ago #

  12. fireproofsocks
    Member
    Plugin Author

    Posted 3 years ago #

    Ok, version 0.9.4.3 contains a new setting for each custom post-type: under the "Advanced" tab you can optionally select a column to sort by and the sort direction.

    You can download the dev build on http://wpcctm.com/ (0.9.4.3-dev) in about an hour, or wait for the patch to be released.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Custom Content Type Manager
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic