• Hello,

    I’m using latest Sublanguage plugin, I’m also using “rps-include” plug-in.

    I want to include one page inside another, and also support translation: I hoped [rsp-include page=slug] or [rsp-include page=ID] would magically include the translated page, but it doesn’t work.
    Not sure whether it comes from sublanguage of rps-include. I ended up using the ID of each of the translation page.

    I really would like not to use a translation-specific page id in the include, and would like to use either slug or original page id.

    Any hint ?

Viewing 1 replies (of 1 total)
  • Hello,

    Please don’t use the translation page ID: I’m going to change the system in the next major release, and this will break everything!

    Unfortunately I have no solution to make it work with this plugin.

    Alternatively you can create your own shortcode, with something like this:

    
    add_shortcode( 'my-include', 'my_include_shortcode' );
    
    function my_include_shortcode( $atts, $content = null ) {
    
      $include_posts = get_posts(array(
        'name' => $atts['slug'], // or 'p' => $atts['id']
        'post_type' => 'any',
        'suppress_filters' => false
      ));
      
      foreach ($include_posts as $include_post) {
        
        $output = '<h2>'.$include_post->post_title.'</h2>';
        $output .= $include_post->post_content;
        
        return $output;
        
      }
      
    }
    

    … using [my-include slug="original-page-slug"] as a shortcode.

    • This reply was modified 8 years, 2 months ago by maxime. Reason: Mistakes in the code
Viewing 1 replies (of 1 total)
  • The topic ‘Including translated page into another page [rps-include]?’ is closed to new replies.