WordPress.org

Ready to get started?Download WordPress

Forums

Custom Post Widget
[resolved] Custom Post Widget with qTranslate (2 posts)

  1. starnetwork
    Member
    Posted 3 years ago #

    Hi,
    on the Widget
    the Custom Post Widget work grate with the Multiple languages content
    and Display the content per language
    but the title is display The titles of all the languages ‚Äč‚Äčtogether

    Best Regards,
    Star Network.

    http://wordpress.org/extend/plugins/custom-post-widget/

  2. Johan van der Wijk
    Member
    Plugin Author

    Posted 3 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic