Git Product home page Git Product logo

Comments (9)

jjgrainger avatar jjgrainger commented on September 23, 2024

Unfortunately not, but its a good idea, I'll have a look into it. Thanks :)

from wp-custom-post-type-class.

matthewsoares avatar matthewsoares commented on September 23, 2024

I tested using 'post' as the post type and it actually works. You do a check if the post type was previously registered so it doesn't conflict.

from wp-custom-post-type-class.

jjgrainger avatar jjgrainger commented on September 23, 2024

Awesome! Thanks for trying it out and getting back.

from wp-custom-post-type-class.

matthewsoares avatar matthewsoares commented on September 23, 2024

@jjgrainger Although It does work at adding taxonomies and all other features, registering posts with this plugin breaks other plugins and not sure why. So it cannot be used as is.

from wp-custom-post-type-class.

jjgrainger avatar jjgrainger commented on September 23, 2024

@matthewsoares Yeah, I never really built it to be used with post types already registered, but I will be working on making this possible, without breaking.

Could you give me some details as to what you've tried to do with the CPT class and what plugins its affected.

Thanks :)

from wp-custom-post-type-class.

matthewsoares avatar matthewsoares commented on September 23, 2024

Thanks for you looking into this. I think it's a good addition.

For example I get this warning.

Notice: Undefined property: CPT::$ID in wp-includes/query.php on line 3939 Notice: Undefined property: CPT::$post_author in wp-includes/query.php on line 3941 Notice: Undefined property: CPT::$post_date in wp-includes/query.php on line 3943 Notice: Undefined property: CPT::$post_date in wp-includes/query.php on line 3944 Notice: Undefined property: CPT::$post_content in wp-includes/query.php on line 3952 Notice: Undefined property: CPT::$post_content in wp-includes/query.php on line 3967

from wp-custom-post-type-class.

jjgrainger avatar jjgrainger commented on September 23, 2024

@matthewsoares Are you getting this error because you're passing the CPT object into a wp_query or query?

Could you give me some additional details as to what it is you're trying to do with the class and what plugins you have installed etc?

Thanks :)

from wp-custom-post-type-class.

matthewsoares avatar matthewsoares commented on September 23, 2024

using $post = new CPT('post'); was giving me issues. Maybe was conflicting with some global vars in my functions. Using $dtpost = new CPT('post'); for example it works. Sorry for the confusion, all is well now.

from wp-custom-post-type-class.

jjgrainger avatar jjgrainger commented on September 23, 2024

@matthewsoares Good detective work. The $post variable you where using with the class was conflicting with one of the Wordpress global variables (codex).

Thanks for getting back, enjoy :)

from wp-custom-post-type-class.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.