• Is there a way to show the author of the minipost without hacking the database query in get_mini_posts?

    Thanks!

Viewing 1 replies (of 1 total)
  • Thread Starter agoranet

    (@agoranet)

    Just to followup, I did end up hacking miniposts.php to do this but it would be nice to have it built-in so I don’t have to do anything during the upgrades. My new output looks like this…

    Ode To Bobby “Kenneth the Page” Jindal
    by Mad Kane
    More… (1 comments)

    If you are interested…

    In miniposts.php (plugins directory – miniposts subdirectory):

    Replace:
    if ($miniposts = $wpdb->get_results(“SELECT ID, post_date, UNIX_TIMESTAMP(post_date) AS post_date_unix, post_content, post_excerpt, post_title FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) WHERE post_date < ‘$now’ AND post_status = ‘publish’ AND $wpdb->postmeta.meta_key = ‘_mini_post’ AND $wpdb->postmeta.meta_value = ‘1’ ORDER BY post_date DESC” . $limit)) {

    With:
    if ($miniposts = $wpdb->get_results(“SELECT wp_posts.ID, post_date, UNIX_TIMESTAMP(post_date) AS post_date_unix, post_content, post_excerpt, post_title, display_name FROM
    $wpdb->posts LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) LEFT JOIN wp_users ON ($wpdb->posts.post_author=wp_users.ID) WHERE post_date <
    ‘$now’ AND post_status = ‘publish’ AND $wpdb->postmeta.meta_key = ‘_mini_post’ AND $wpdb->postmeta.meta_value = ‘1’ ORDER BY post_date DESC” . $limit)) {

    A little further down find:
    $meta = str_replace(‘%commentcount%’, $commentcount, $meta);

    and add this line under it:
    $meta = str_replace(‘%display_name%’, $minipost->display_name, $meta);

    Now in your admin area where you can specify the format of output for the miniposts, add %display_name% wherever you’d like it. Mine is now…

    <p class=”minipost”>%title%
    by %display_name%
    %more% (%commentcount% comments)</p>

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Miniposts] Show author of minipost?’ is closed to new replies.