Support » Plugin: Content Blocks (Custom Post Widget) » Custom Post Widget with qTranslate

Viewing 1 replies (of 1 total)
  • Plugin Author Johan van der Wijk

    (@vanderwijk)

    Hi Shalom,

    Because the qTranslate plugin is quite complex I think the developer of that plugin might be in a better position to answer your question.

    As you can see by the code below, all the Custom Post Widget plugin does is to get the post_content and display the post_title if this is set in the widget:

    function widget($args, $instance)
      {
        extract($args);
    
        $custom_post_id  = ( $instance['custom_post_id'] != '' ) ? esc_attr($instance['custom_post_id']) : __('Find', 'custom-post-widget');
    
        /* Variables from the widget settings. */
        $show_custom_post_title = isset( $instance['show_custom_post_title'] ) ? $instance['show_custom_post_title'] : false;
    
        $content_post = get_post($custom_post_id);
        $content = $content_post->post_content;
        $content = apply_filters('the_content', $content);
        $content = str_replace(']]>', ']]>', $content);
    
        echo $before_widget;
        if ( $show_custom_post_title )
        {
          echo $before_title . $content_post->post_title . $after_title; // This is the line that displays the title (only if show title is set)
        }
        echo $content; // This is where the actual content of the custom post is being displayed
        echo $after_widget;
    
      }
    }

    I hope this helps in troubleshooting this issue.

Viewing 1 replies (of 1 total)
  • The topic ‘Custom Post Widget with qTranslate’ is closed to new replies.