Viewing 17 posts - 1 through 17 (of 17 total)
  • Author
    Posts
  • #761396

    Just wondering if there is any way of getting the CPT from Toolset Types to show inside the editor option list. I have used the following:

    // add the custom posttypes to the builder elements
    add_theme_support('add_avia_builder_post_type_option');
    add_theme_support('avia_template_builder_custom_post_type_grid');

    But the cpt from Types does not show up in the list. All other CPTfrom woocommerce and other plugins are there just not from Types plugin.
    Is there any sollution to this other than switching to CPT UI plugin. Please advice.

    Already opened a support ticket at Toolset In short:

    Types follows all WordPress standards in creating these custom post types.
    I would open up a thread with the Enfold team and report this incompatibility.

    Hope to get a solution as I like to use Enfold but also need to use Toolset Types.

    #761405

    Hey herbie4!

    Thank you for using Enfold.

    Regarding the previous thread, I found out that you can use a filter to add more post types in the “Select Post Type” settings. Use the following filter:

    add_filter('avf_registered_post_type_array', 'avf_registered_post_type_array_mod', 10, 2);
    function avf_registered_post_type_array_mod($post_type, $args) {
            // do something
    	return $post_type; 
    }

    Please ask the Toolset support if they have an existing function to retrieve registered custom post types via their plugin.

    Best regards,
    Ismael

    #761429

    Hello Ismael,
    I added your question in my support thread at Toolset. I will let you know if there is a response.

    #761774

    Hi!

    Thank you for the update.

    I read the support’s response and maybe this filter will work.

    function avf_registered_post_type_array_mod($post_type, $args) {
            $types = get_post_types($args,'objects');
    	$merge = array();
    	if(!empty($types))
    	{
    		foreach($types as $type)
    		{
    			if(!in_array($type->label, $post_type)) {
    				$merge[$type->label] = $type->name;
    			}
    		}
    	}
    
    	$post_type = array_merge($merge, $post_type);
    	return $post_type;
    }
    
    add_action('init','ava_get_tooltypes_posttypes', 10);
    function ava_get_tooltypes_posttypes() {
    	add_filter('avf_registered_post_type_array', 'avf_registered_post_type_array_mod', 10, 2);
    }

    If you run the “$types” variable in a var_dump function, let me know if you can see the custom post types created by the plugin.

    Regards,
    Ismael

    #761791

    Hello Ismael,
    In reply to you earlier question:

    Please ask the Toolset support if they have an existing function to retrieve registered custom post types via their plugin.

    I have the following answer from toolset:

    Our developers have responded to their question with:

    “Types registers its custom post types at init:10 which is the usual place to do such thing: https://codex.wordpress.org/Function_Reference/register_post_type" which means that get_post_types should work as intended.

    I’ve escalated this to our internal developers in case they can help offer insight as to why these CPTs aren’t being shown. I’ll keep you updated with anything they find.

    #761798

    Hello Ismael,
    In regard to your question:

    If you run the “$types” variable in a var_dump function, let me know if you can see the custom post types created by the plugin.

    I made a dump of $types using your function and I can see all the cpt as listed in avia builder but not the ‘training’ cpt.

    #761818

    Hi!

    Please try to replace “init” with “after_setup_theme” or “wp_loaded” then run the dump again.

    Cheers!
    Ismael

    #761829

    “after_setup_theme” -> gives the same cpt list as before, but not ‘training’
    “wp_loaded” -> gives no output at all.

    #762820

    Hi!

    I’ve read Toolset’s response and managed to make this work based on the info that they provided. However, I’m not sure if this is not going to create any issues in the future. Please edit the config-templatebuilder > php > template-builder.class.php file, look for this code:

    add_action('init', array(&$this, 'loadLibraries') , 5 );
    			add_action('init', array(&$this, 'init') , 10 );
    

    .. replace it with:

    		add_action('init', array(&$this, 'loadLibraries') , 15 );
    			add_action('init', array(&$this, 'init') , 20 );
    

    And then use the default ‘init’ hook in the filter above.

    NOTE: You can’t do this modification in a child theme. We’ll report the issue to Kriesi for future considerations.

    Best regards,
    Ismael

    #763028

    Hello Ismael,
    I got the following information from Toolset developers:

    “The case with Enfold is exactly the same. Their init:10 callbacks includes a AviaBuilder::init method, which calls the AviaBuilder::createShortcode method, which instantiates all the aviaShortcodeTemplate subclasses. Each one of those subclasses constructor then calls their aviaShortcodeTemplate::extra_config method, which then calls the popup_elements method of each individual shortcode class.

    In the case of the portfolio module (shortcode), that popup_elements method contains a call to AviaHtmlHelper::get_registered_post_type_array which fires a native get_post_types call.

    By the time this all happens, we still did not reach the init:10 callback by Types, wpcf_init_custom_types_taxonomies, hence no post type or taxonomy from Types is available.

    Again, as we do register our items in the right place, I would strongly suggest contacting the Enfold theme authors and encourage them to initialize anything requiring custom post types or taxonomies to happen way later.”

    It seems that the priority of callbacks should be modified so that custom post types created with the correct priority aren’t excluded.

    original thread at Toolset forum

    #763065

    Hi!

    Thank you for the update. Yes, I’ve read their response and provided a working solution above.

    // https://kriesi.at/support/topic/custom-post-type-not-appearing-in-posts-dropdown-in-portfolio-grid-element/#post-762820

    Best regards,
    Ismael

    #763187

    Hello Ismael,
    Great. Although I do not consider a core hack a fix, it is more just a temporary solution. I would like to see a more permanent future proof fix. So in what version of Enfold is a fix planned so the above mentioned core hack will not be needed?

    #763499

    Hi!

    Yes, we understand. There’s no ETA yet but it’s under consideration.

    NOTE: You can’t do this modification in a child theme. We’ll report the issue to Kriesi for future considerations.

    Cheers!
    Ismael

    #814685

    Hello
    I have the exact same question … Can somebody make a short summary what I have to do to makes this work?
    Because I think I’m doing something wrong here … It does not work like it should.
    Thank you.

    #816052

    Hi,


    @jurgen1979

    Are you following what Ismael wrote here?

    what is the problem, what is not working?

    Best regards,
    Basilis

    #816427

    @jurgen1979
    This is still not fixed in Enfold. As In my original post: CPT from toolset will not show in the grid element without a core hack! So I would not advice that as a fix. I fixed this by using CPT UI plug-in instead of Toolset CPT. Not a good fix but at least it is working for now. If you want to use Toolset, you will need to use an other theme.

    #816616

    Hi @herbie4,

    Thanks for sharing your findings, much appreciated.

    Best regards,
    Rikard

Viewing 17 posts - 1 through 17 (of 17 total)
  • You must be logged in to reply to this topic.