• Hello,

    I have made a plugin whitch select posts by different dates (deaddate, startdate, enddate…). I have add the fields in the DB first. So I’m fighting with something relatively hard I think (for me it’s sure ! :-)).

    I have make everything work but one thing : my post title, when they are display, don’t have italic or bold, etc. I have search for the WP fonction, I found “apply_filters” but when I use it, it says to me there is a missing argument… but whitch ??? I’m stopped by this.

    One of my homemade (almost perfect) functions :

    function parutions($categorie, $nouveau, $limite) {
    global $wpdb;
    $now = current_time(‘mysql’);
    $arcresults2 = $wpdb->get_results(“SELECT ID, post_title, post_date FROM ” . $wpdb->posts . ” LEFT JOIN wp_post2cat ON (wp_posts.ID = wp_post2cat.post_id) WHERE category_id = $categorie AND post_date <‘” . $now . “‘ AND post_status=’publish’ AND post_password=” ORDER BY post_date DESC LIMIT $limite”);

    if ($arcresults2) {
    foreach ($arcresults2 as $arcresult2) {

    if ($arcresult2->post_date != ‘0000-00-00 00:00:00’)
    {$url = get_permalink($arcresult2->ID);
    $arc_title = $arcresult2->post_title;

    if ($arc_title)

    $text = strip_tags($arc_title);

    else

    $text = $arcresult2->ID;
    $title_text = wp_specialchars($text, 1);

    echo “<img src=’http://www.cometes.org/images/annonces_puce.png&#8217; alt=’puce’ /> “;

    // Si Nouveau

    $datedepublication = $arcresult2->post_date;
    $datedujour = current_time(‘mysql’);
    $ecart=nbjours($datedepublication,$datedujour);

    if ($ecart<=$nouveau){

    echo “<span id=nouveau class=nouveau>”;
    echo “nouveau”;

    // Si Posté ce jour
    $ecart=nbjours($datedepublication,$datedujour);
    if ($ecart<=1){ echo ” <span id=postecejour class=postecejour>(posté ce jour)</span>”; }

    // fin si Posté ce jour

    echo ” : “;
    echo “</span>”;

    }

    // fin Si Nouveau

    echo”“;
    echo “$text”;
    echo “

    “;

    }

    else

    { echo “Aucune annonce pour le moment !”; }

    }}}

    Thanks for any help from any planet ! 🙂

  • The topic ‘Formating Text with homemade SQL query’ is closed to new replies.