Celebrating 7 Years! Get up to $30 off GeneratePress Premium!

[Resolved] Page header selection with WPML

Home Forums Support [Resolved] Page header selection with WPML

Home Forums Support Page header selection with WPML

  • This topic has 8 replies, 2 voices, and was last updated 3 years ago by Enrico.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #476822
    Enrico

    Hello,
    it’s pretty cool that page headers now are post types and can therefore can be globally edited. However there is one thing that seems broken when used with wpml. When I make page_headers translateable, it shows all page headers in all languages in the dropdown and not only the page header for the selected language.

    GeneratePress 2.0.2
    GP Premium 1.5.6
    #477380
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    In the select box inside the Layout metabox? That may just be the way it’s set up. Have you checked with them? Their support team is awesome πŸ™‚

    #477663
    Enrico

    So I looked into it myself and found that when I disable suppress filters in the call to get_posts, I will only see the page headers available in the selected language. It is on line 709 in gp-premium/page-header/functions/metabox.php

    
    $page_headers = get_posts(array(
    	'posts_per_page' => -1,
    	'orderby' => 'title',
    	'post_type' => 'generate_page_header',
    	// I added this line so the wpml filters can modify the query
    	'suppress_filters' => 0
    ));
    

    Maybe you can add this as an option or do this by default? It would make sense to add this line if WPML is running. Thanks

    #478524
    Tom
    Lead Developer
    Lead Developer

    Very interesting – thanks for tracking that down for me! I’ll do some testing and will likely get it added to the next version.

    #478585
    Enrico

    Great!
    I wouldn’t know if it would have any side effects (can not think of any), but if you want to be on the safe side, another possibility would be to run the query args through a filter we could hook into. I think you will know best what to do πŸ™‚
    I will keep this thread open, as the issue is not really resolved yet.

    #479231
    Tom
    Lead Developer
    Lead Developer

    Looks good to me – I’ve made the change in GPP 1.6.

    Thank you! πŸ™‚

    #567112
    Enrico

    Hello,

    I just realized that the same ‘issue’ applies to the global selection of page headers. Since you are doing it with suppress_filter in the layout meta box now, it would be consistent to have the same behaviour in the global location dropdown menus.

    #567888
    Tom
    Lead Developer
    Lead Developer

    Done – should be good to go in 1.6.3.

    Thanks!

    #569237
    Enrico

    Thank you!

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