• dlature1

    (@dlature1)


    I have two custom post types which make up the majority of my overall posts. Post dates show on regular posts, but not on either Custom Post types. I found this after I had to add a piece of code to my theme that enabled CPT’s to show on the Front Page listing (ie. The Loop). What is keeping the dates from being shown? On the regular post type, just below the title, there is a line that says “Posted on September 18, 2015 by Dale Lature” , but is missing from the Custom Post Types. Ideas?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter dlature1

    (@dlature1)

    a related problem is that the calendar does not include any custom post types. When I had no “regular/default” posts that had been published in October, when November rolled around, the previous month link on the Calendar was labeled “Sep”. Sure enough, when I published a Draft I had done in October but never published, the prev month link changed to Oct. So how do we get the post date problem solved if we want WordPress to treat certain Custom Post Types just like it does default posts?

    Thread Starter dlature1

    (@dlature1)

    my site is at wp.theoblogical.org and the first problem can be seen in the first 3 posts. The first one is a normal, regular post. The next two are custome post types, and both do not have the line “Posted On -date” by -User” metadata that is under the Post Title on the first post.

    The second problem can be seen in the Post Calendar or in the Date archive like here: https://wp.theoblogical.org/?m=201509 and it shows only regular posts there, and the calendar prev next links skip over August, since all of my posts in August were CPTs.

    Thread Starter dlature1

    (@dlature1)

    deleted

    Thread Starter dlature1

    (@dlature1)

    I realize that any given plugin are not “RESPONSIBLE” for problems that derive from what is really WordPress core. I posted here and in CPT UI only because I knew a key person in the CPT UI team, and they put me in touch with one of the other key people there. That’s a great plugin, BTW. Been using it almost since it came out. But I am still searching for a way to enable my Date Archive to properly see that most of my posts are of one Custom Post Type or another. I had started using Custom Post Types as soon as they were announced, given what I understood of their usefulness for handling and organizing content. When WordPress 3 came out, it was heavily encouraging us to use CPTs. But it seems that we still had to rely heavily on Plugins to take advantange of it. Now as I am trying to find a new theme, I have discovered how much of my Blog is broken in its functionality because WP doesn’t handle my Custom Post types well. I am wondering why WordPress hasn’t made it as easy as , say, checking a check-box that tells WP to handle some or all CPTs as actual posts (sure, they are “Custom” Post Types, but they are, after all, still “POSTS”. NOw when a day on the WordPress Calendar is clicked, which shows there are posts on that day, when WordPress doesn’t find any of the default post type of “post”, it gives a 404 error. I hunted around almost all day yesterday and found a few pieces of code to add to my “archive.php” file so that it will see Custom Post Types. But still, the links do not work. Something amiss with the Permalinks. Yet more problems. Why, WordPress, are you leaving so many of us who are less than the most capable WP coders, out in the cold on CPTs? I know PHP, and have also done work with WordPress DB and various customizations. But this is getting to be a time suck, but I have to stick with it since I am trying to enhance my latest efforts at EcoEcclesia to more fully leverage the power of WordPress. I hope WordPress developers and coders will (or maybe ARE) working on this. Build it in to the Admin so that I dont have to continue to add code to my themes. Plugins can only go so far when WordPress isn’t providing hooks into the Core to enable the use of the Custom Post Types so that it is compatible across ALL of WordPress’ features.

    Thread Starter dlature1

    (@dlature1)

    just a bit ago I found this, which seems to be working. I hope there are no unforseen problems here in this approach:

    // Add custom post types to archives - renamed some_function to CPT_ArchiveInclude  Develocom's code from https://css-tricks.com/snippets/wordpress/make-archives-php-include-custom-post-types/
    //11-22-15   keeping my fingers crossed!
    function CPT_ArchiveInclude( $query ) {
      if(!is_admin()) {
    
      // For categories, lets add 'nav_menu_item' to the array so we don't break our navigation.//
      if( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {
        $query->set( 'post_type', array(
         'post', 'nav_menu_item', 'ecoecclesia', 'occupytheology'
        ));
        return $query;
      }
      if( is_archive() && !is_post_type_archive() && empty( $query->query_vars['suppress_filters'] ) ) {
        $query->set( 'post_type', array(
         'post', 'ecoecclesia', 'occupytheology', 'aktt_tweet'
        ));
        return $query;
      }
      if( is_home() && empty( $query->query_vars['suppress_filters'] ) ) {
        $query->set( 'post_type', array(
         'post', 'ecoecclesia', 'occupytheology'
        ));
        return $query;
      }
     }
    }
    add_filter( 'pre_get_posts', 'CPT_ArchiveInclude' );
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Dates not displaying on Custom Post Types’ is closed to new replies.