WordPress.org

Ready to get started?Download WordPress

Forums

Adding a plugin to a hook (3 posts)

  1. Jeroen G
    Member
    Posted 4 years ago #

    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?

  2. Jeroen G
    Member
    Posted 4 years ago #

    Help?

  3. Jeroen G
    Member
    Posted 4 years ago #

    Someone?

Topic Closed

This topic has been closed to new replies.

About this Topic