• I’m using a static page for my homepage and I wanted to be able to pull content from a custom field that appears in every post onto said homepage. However, being a PHP/SQL n00b at times, I’m drawing a complete blank on how to do it. I have C2C_Custom_Fields installed, but it’s not really helping me…

    <?php
    $how_many=5; //How many posts do you want to show
    require_once("cms/wp-config.php"); // Change this for your path to wp-config.php file ?>
    <?
    $news=$wpdb->get_results("SELECT <code>ID</code>,<code>post_title</code> FROM $wpdb->posts
    WHERE <code>post_type</code>=\"post\" AND <code>post_status</code>= \"publish\" ORDER BY 'ID' ASC LIMIT ".$how_many);
    foreach($news as $np){
    printf ("<a href=\"cms/index.php?p=%s\"><?php echo c2c_get_custom('eventdate'); ?>&mdash;%s</a><br />", $np->ID,$np->post_title);
    
    }?>

    So if anyone could help me inject a custom field code into this, it would be greatly appreciated!

  • The topic ‘Custom Fields in static pages’ is closed to new replies.