Search

הוספת תוכן לתיאור המוצר בווקומרס

אם אתם מעוניינים להוסיף תוכן לתיאור המוצרים בווקומרס באופן גורף השתמשו בקוד הבא. הוסיפו אותו לקובץ functions.php בתבנית שלכם ושנו את הטקסט כרצונכם בשורה מספר 5. שימו לב כי קוד זה יוסיף את המידע בסוף התוכן של תיאור המוצרים.

function change_woocommerce_description( $content ) {
    // Only for single product pages in woocommerce
    if ( is_product() ) {
        // The custom content to add
        $custom_content = '<p class="custom-content">' . __("This is the last line in the description", "woocommerce").'</p>';
        // Inserting the custom content at the end of the current product description
        $content .= $custom_content;
    }
    return $content;
}
add_filter( 'the_content', 'change_woocommerce_description' );

עוד מידע על שינוי והוספת שדות למוצרים של ווקומרס תמצאו בפוסט כיצד להוסיף שדות נוספים (Custom Fields) לעמוד המוצר של ווקומרס.

מצאתם טעות בקוד? הסניפט לא עובד לכם? רישמו לי בתגובות ואני מבטיח לטפל בכך במהרה ולספק סניפט תקין...
0 תגובות...

תגובה חדשה

Up!
לבלוג