• I’m learning how I can make a plugin. And at the moment I have this, mainly from the documentation on wordpress.org:

    function fp_get_latest(){
    	$query_latest = "
        SELECT wposts.*
        FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
        WHERE wposts.ID = wpostmeta.post_id
        AND wpostmeta.meta_key = 'portfolio'
        AND wpostmeta.meta_value = '1'
        AND wposts.post_status = 'publish'
        AND wposts.post_type = 'post'
        ORDER BY wposts.post_date DESC
     ";
    $fp_latest = $wpdb->get_results($query_latest, OBJECT);
    return $fp_latest;
    }
    ?>
    add_action('get_header', 'fp_get_latest');

    But when I activate the plugin and visit my blog, I get a HTTP-error 500.
    What do I wrong?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding a plugin to a hook’ is closed to new replies.