Making WordPress.org


Ignore:
Timestamp:
09/10/2015 08:58:08 PM (9 years ago)
Author:
ocean90
Message:

Trac Components: Add make/flow posts to components pages.

Fixes #1219.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/trac-notifications/trac-components.php

    r1162 r1868  
    224224        if ( ! $this->page_is_component( $post ) || doing_action( 'wp_head' ) || ! did_action( 'wp_head' ) ) {
    225225            return $content;
    226         }   
     226        }
    227227
    228228        ob_start();
     
    263263        ) );
    264264        if ( $recent_posts->have_posts() ) {
    265             echo "<h3>Recent posts on the blog</h3>\n<ul>";
     265            echo "<h3>Recent posts on the make/core blog</h3>\n<ul>";
    266266            while ( $recent_posts->have_posts() ) {
    267267                $recent_posts->the_post();
     
    272272            wp_reset_postdata();
    273273        }
     274
     275        switch_to_blog( 34 ); // Blog ID of make/flow
     276        $flow_posts = new WP_Query( array(
     277            'post_type' => 'post',
     278            'post_status' => 'publish',
     279            'posts_per_page' => 5,
     280            'tag_slug__in' => $post->post_name
     281        ) );
     282        if ( $flow_posts->have_posts() ) {
     283            echo "<h3>Recent posts on the make/flow blog</h3>\n<ul>";
     284            while ( $flow_posts->have_posts() ) {
     285                $flow_posts->the_post();
     286                echo '<li><a href="' . get_permalink() . '">' . get_the_title() . '</a> (' . get_the_date() . ")</li>\n";
     287            }
     288            echo '</ul>';
     289            echo 'View all posts tagged <a href="' . get_term_link( $post->post_name, 'post_tag' ) . '">' . $post->post_name . "</a>.\n\n";
     290            wp_reset_postdata();
     291        }
     292        restore_current_blog();
    274293
    275294        $sub_pages = wp_list_pages( array( 'child_of' => $post->ID, 'post_type' => 'component', 'echo' => false, 'title_li' => false, 'exclude' => implode( ',', array_keys( $subcomponents ) ) ) );
     
    578597        if ( $once ) {
    579598            $once = false;
    580             echo '<thead><tr><th>Component</th><th style="width: 50px">Tickets</th><th style="width: 50px">7 Days</th><th style="width: 50px">0&nbsp;Replies</th><th>Maintainers</th></tr></thead>';   
     599            echo '<thead><tr><th>Component</th><th style="width: 50px">Tickets</th><th style="width: 50px">7 Days</th><th style="width: 50px">0&nbsp;Replies</th><th>Maintainers</th></tr></thead>';
    581600        }
    582601
     
    625644}
    626645new Make_Core_Trac_Components;
    627 
Note: See TracChangeset for help on using the changeset viewer.