شعار Devvn Html To Wp Acf

Devvn Html To Wp Acf

المجتمع
levantoan
devvn-html-to-wp-acf

Convert static HTML landing pages into WordPress page templates with ACF (Advanced Custom Fields) or SCF (Secure Custom Fields) integration. Covers field registration via PHP, template conversion with get_field/have_rows, CSS minification, asset stripping, and page speed optimization.

نظرة عامة

الناشرlevantoan
المستودعDevVN-WordPress-Skills
اسم المهارةdevvn-html-to-wp-acf
النجوم
30
التفريعات
7
الملفات المرفقة
4
الروابط
  • تعليمات بصيغة Markdown

    ملف SKILL.md يُحمّله النموذج عند الحاجة، فلا يستهلك توكنات إلا عندما يَرِد طلب ذو صلة فعلًا.

  • تعمل مع أي نموذج لغوي كبير

    مهارات الذكاء الاصطناعي مكتوبة بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا تعمل مع GPT أو Claude أو Gemini أو Grok أو نموذج محلي.

  • الملفات المرفقة: 4

    نصوص برمجية وقوالب ومراجع يمكن للنموذج قراءتها أثناء عمله. الملفات للقراءة فقط ولا تُنفّذ أبدًا.

  • مفتوحة المصدر

    نشرها levantoan على GitHub. اطّلع على المصدر قبل تثبيتها.

التثبيت

ثبّت مهارة الذكاء الاصطناعي Devvn Html To Wp Acf في TypingMind لاستخدامها مع أي نموذج لغوي كبير، أو أضفها إلى وكيل ذكاء اصطناعي آخر يقرأ SKILL.md.

1

التثبيت في TypingMind

يُثبّت TypingMind المهارة مباشرةً من مجلدها على GitHub — فيقرأ SKILL.md، ويجمع ملفات الموارد في حزمة، ويحفظ النتيجة محليًا.

  1. افتح التطبيق وانتقل إلى «الإضافات» ثم «المهارات».
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/levantoan/DevVN-WordPress-Skills/tree/main/skills/devvn-html-to-wp-acf
  4. فعّل المهارة في كل محادثة تريد إتاحتها فيها.
الإضافات ← المهارات ← إضافة مهارة ← من رابط GitHub، ثم الصق رابط المجلد واضغط على «متابعة».
2

التثبيت في وكيل ذكاء اصطناعي آخر

يمكن لأي وكيل ذكاء اصطناعي يقرأ تنسيق Agent Skills استخدام هذه المهارة — انسخ المجلد إلى مجلد المهارات الخاص بذلك الوكيل.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/levantoan/DevVN-WordPress-Skills.git /tmp/DevVN-WordPress-Skills
mkdir -p .claude/skills
cp -r /tmp/DevVN-WordPress-Skills/skills/devvn-html-to-wp-acf .claude/skills/devvn-html-to-wp-acf
أعد تشغيل Claude Code بعد النسخ ليتعرّف على المهارة الجديدة.

استخدمها في TypingMind

فعّل Devvn Html To Wp Acf في أي محادثة على TypingMind وسيتولى النموذج الباقي. تتضمن مطالبة النظام اسمها ووصفها، وبمجرد ورود طلب ذي صلة، يُحمّل النموذج التعليمات الكاملة تلقائيًا — فلا تحتاج إلى استدعائها يدويًا، ولا تستهلك أي توكنات حتى تُستخدم فعليًا.

يُحمّل النموذج مهارة Devvn Html To Wp Acf تلقائيًا بمجرد ورود طلب ذي صلة بها.

تعمل مع أي نموذج ذكاء اصطناعي

مهارات الذكاء الاصطناعي هي تعليمات بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا لا ترتبط Devvn Html To Wp Acf بالنموذج الذي كُتبت له. ثبّتها مرة واحدة في TypingMind واستخدمها مع GPT-5 أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو نموذج محلي تشغّله بنفسك — كل ذلك باستخدام مفاتيح API الخاصة بك.

  • تُحمَّل عند الحاجة فقط

    تتضمن مطالبة النظام الاسم والوصف فقط. وتُجلب التعليمات عند أول طلب ذي صلة، لذا لا تستهلك تعليمات المهارة أي توكنات ما دامت المهارة غير مستخدمة.

  • بدّل النماذج أثناء المحادثة

    لأن المهارة تعليمات وليست شيفرة، فإن تغيير النموذج لا يعطّلها — فالنموذج التالي يقرأ ملف SKILL.md نفسه.

تعليمات المهارة

هذا هو محتوى SKILL.md الذي يُحمّله النموذج. اقرأه قبل التثبيت — فالمهارة عبارة عن تعليمات سيتبعها نموذجك.

HTML to WordPress + ACF/SCF Conversion

ACF vs SCF: Secure Custom Fields (SCF) is the WordPress.org-maintained fork of ACF. Both share the same API — get_field(), have_rows(), acf_add_local_field_group(), etc. All code in this skill works with either plugin without modification. When this document says "ACF", it applies equally to SCF.

When to use

Use this skill when converting a static HTML page (landing page, one-page site, campaign page) into a WordPress page template that uses ACF or SCF for dynamic content management:

  • Converting a standalone .html file into a .php page template
  • Making hardcoded text, images, repeaters editable via ACF admin
  • Registering ACF field groups in PHP (no JSON import needed)
  • Optimizing the converted page for speed (inline CSS minification, stripping unnecessary WP assets)
  • Setting up Classic Editor for specific page templates in a block theme

Inputs required

  • The source HTML file (or existing .php template with hardcoded content)
  • The target WordPress theme directory
  • Whether ACF Pro is available (repeater, flexible content require Pro)
  • Any existing functions.php to extend

Procedure

1) Analyze the HTML structure

  1. Read the full HTML file and identify every content section
  2. Map each section to a category:
    • Simple fields: headings, descriptions, badge text, phone, email, address, URLs
    • Repeaters: lists of cards, features, FAQ items, stats, gallery items, menu columns
    • Images: hero backgrounds, product photos, icons, gallery
    • Rich text: content blocks with links (footer menus, legal text)
  3. Group fields into logical tabs matching the page sections (Hero, Features, Products, Services, FAQ, Contact, Footer, etc.)
  4. Note which sections need fallback HTML (default content when ACF fields are empty)

Read: references/field-mapping.md

2) Create the ACF field registration file

  1. Create acf-{template-name}-fields.php in the theme root
  2. Use acf_add_local_field_group() inside an acf/init action hook
  3. Structure fields with tabs for each section
  4. Apply these rules:
    • Guard with if ( ! function_exists( 'acf_add_local_field_group' ) ) { return; }
    • Use descriptive, prefixed keys: field_{prefix}_{section}_{name}
    • Use descriptive, prefixed names: {prefix}_{field_name}
    • Set default_value for all text/textarea fields with the original hardcoded content
    • Use return_format => 'url' for images (simpler output)
    • Use repeater for any list of items (cards, features, FAQ, stats)
    • Use wysiwyg with toolbar => 'basic' and media_upload => 0 for rich link content (footer menus, legal text)
    • Set location rule to match the page template file
  5. Include the file from functions.php with require_once get_theme_file_path()

Read: references/acf-registration.md

3) Create helper functions in the template

Add these at the top of the page template file, before any HTML output:

php
// Helper: get ACF field with fallback.
function {prefix}_field( $name, $default = '' ) {
    if ( ! function_exists( 'get_field' ) ) {
        return $default;
    }
    $val = get_field( $name );
    return ( $val !== null && $val !== '' && $val !== false ) ? $val : $default;
}

Also declare shared variables used across multiple sections (phone, email, address, logo URL) at the top so both contact and footer sections can reference them.

4) Convert HTML sections to ACF-powered PHP

For each section in the HTML, apply these conversion patterns:

Simple text fields:

php
<?php echo esc_html( {prefix}_field( 'field_name', 'Default text' ) ); ?>

Image fields:

php
<?php $img = {prefix}_field( 'field_name', 'fallback-url' ); ?>
<img src="<?php echo esc_url( $img ); ?>" alt="...">

Repeater fields:

php
<?php if ( function_exists( 'have_rows' ) && have_rows( 'repeater_name' ) ) : ?>
    <?php while ( have_rows( 'repeater_name' ) ) : the_row(); ?>
        <div><?php echo esc_html( get_sub_field( 'sub_field' ) ); ?></div>
    <?php endwhile; ?>
<?php else : ?>
    <!-- Original hardcoded HTML as fallback -->
<?php endif; ?>

WYSIWYG fields (rich text with links):

php
<?php echo wp_kses_post( {prefix}_field( 'field_name', '<a href="#">Default</a>' ) ); ?>

Inline background images:

php
style="background: linear-gradient(...), url('<?php echo esc_url( $bg_url ); ?>') center/cover no-repeat;"

Form shortcodes (replace hardcoded <form>):

php
<?php echo do_shortcode( {prefix}_field( 'form_shortcode', '' ) ); ?>

Use a textarea ACF field so users paste shortcodes from their form plugin (CF7, WPForms, Fluent Forms, etc.). Remove all hardcoded <form> HTML and any associated demo JS.

Key rules:

  • Always provide fallback content (the original HTML) so the page works without ACF data
  • Always escape output: esc_html() for text, esc_url() for URLs, esc_attr() for attributes, wp_kses_post() for rich HTML
  • Check function_exists('have_rows') before any repeater loop
  • For repeaters with counters/alternating layout, use a $i counter variable

Read: references/template-patterns.md

5) Optimize CSS delivery

  1. Move hardcoded CSS background URLs out of <style> into inline style="" attributes on elements (so they can be dynamic)
  2. Wrap the <style> block with output buffering and minify:
php
<style><?php ob_start(); ?>
    /* ... all CSS ... */
<?php
$css = ob_get_clean();
$css = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $css);
$css = preg_replace('/\s+/', ' ', $css);
$css = preg_replace('/\s*([{}:;,])\s*/', '$1', $css);
$css = str_replace(';}', '}', $css);
echo trim($css);
?></style>

6) Integrate with WordPress head/footer and strip unnecessary assets

  1. Add <?php wp_head(); ?> before </head> — this outputs SEO plugin meta tags (Yoast, RankMath, etc.)
  2. Remove any hardcoded <title> and <meta name="description"> — let SEO plugins handle these
  3. Add filtered wp_footer() before </body> — keep form plugin scripts + performance plugins:
php
<?php
ob_start();
wp_footer();
$wp_footer_output = ob_get_clean();
$wp_footer_output = preg_replace( '/<link[^>]*rel=[\'"]stylesheet[\'"][^>]*>/i', '', $wp_footer_output );
$keep_js = array( 'rocket', 'lazyload', 'contact-form-7', 'wpcf7', 'swv', 'wp-i18n', 'wp-hooks', 'wp-polyfill', 'wp-includes' );
$wp_footer_output = preg_replace_callback(
    '/<script\b[^>]*>.*?<\/script>/si',
    function( $m ) use ( $keep_js ) {
        foreach ( $keep_js as $k ) {
            if ( stripos( $m[0], $k ) !== false ) {
                return $m[0];
            }
        }
        return '';
    },
    $wp_footer_output
);
echo $wp_footer_output;
?>
  1. In functions.php, add an asset stripping function on template_redirect that recursively resolves form plugin dependencies (so wp-i18n, wp-hooks, etc. are kept automatically):
  2. Important: Do NOT remove_action( 'wp_footer', 'wp_print_footer_scripts' ) — this blocks form plugin JS from loading
  3. Add CSS overrides for the form plugin in the template <style> block to match the landing page design (inputs, submit button, validation messages, dark-background variants)

Read: references/asset-stripping.md

7) Additional WordPress integrations

  1. Classic Editor for the template — If the theme uses block editor but ACF works better with Classic Editor:
php
add_filter( 'use_block_editor_for_post', function ( $use, $post ) {
    if ( get_page_template_slug( $post ) === '{template-file}.php' ) {
        return false;
    }
    return $use;
}, 10, 2 );
  1. Disable admin bar on the landing page:
php
add_filter( 'show_admin_bar', '__return_false' );
  1. Remove old ACF JSON export if one was created during development — the PHP registration replaces it.

Verification

  • Page renders identically to the original HTML when no ACF data is entered (fallback mode)
  • All sections update correctly when ACF fields are filled in the admin
  • View source shows no unnecessary CSS/JS from WordPress core, theme, or plugins
  • SEO plugin meta tags (canonical, og:tags, schema) appear in <head>
  • No admin bar visible on the frontend
  • Page loads with Classic Editor in wp-admin (if configured)
  • Repeater fields add/remove items correctly and the page reflects changes
  • All output is properly escaped (no raw echo get_field() without escaping)

Failure modes / debugging

SymptomCauseFix
ACF fields don't appear in adminLocation rule doesn't match templateCheck post_template value matches the .php filename exactly
Fields appear but page shows defaultsget_field() returns false/emptyEnsure field names in PHP match ACF registration name values
Repeater shows nothinghave_rows() returns falseCheck repeater field name matches, verify sub_field names
Page shows WP theme CSS/JSAsset stripping not runningVerify is_page_template() check matches template filename
Broken layout after conversionCSS background URLs still hardcoded in <style>Move dynamic backgrounds to inline style="" on elements
function_exists('get_field') returns falseACF/SCF not activeThe fallback pattern handles this — page uses default HTML. Works with both ACF and SCF
Repeater fields missing in SCF FreeUsing ACF Free (not Pro)SCF includes repeater for free; ACF Free does not. Switch to SCF or upgrade to ACF Pro
Images not showingReturn format mismatchUse return_format => 'url' for image fields used in src=""
Footer variables undefinedVariables declared in wrong scopeDeclare shared variables ($phone, $email, etc.) at the top of the template
Form plugin JS error: Cannot read 'i18n'Core dependency scripts strippedUse recursive dependency resolution in asset stripping; do NOT remove wp_print_footer_scripts
Form not submitting / no AJAXForm plugin script not loadedAdd plugin handles to $keep_roots in functions.php and keywords to $keep_js in footer filter
Form unstyled after conversionPlugin CSS stripped with all other stylesAdd CSS overrides for form plugin classes (.wpcf7-form, etc.) in the template <style> block
Form shortcode shows raw textdo_shortcode() not wrapping the field outputEnsure template uses echo do_shortcode( {prefix}_field( 'form_shortcode', '' ) )
intelephense "undefined function" errorsIDE missing WordPress stubsThese are IDE-only — runtime works fine. Install php-stubs/wordpress-stubs if needed

Escalation

  • If the HTML uses JavaScript frameworks (React, Vue) for rendering — this skill covers static HTML only
  • If multi-language support is required — coordinate with WPML/Polylang setup
  • If the page template needs to work across multiple themes — consider making it a plugin instead

الملفات المرفقة

يقرأ النموذج هذه الملفات عند الحاجة ما دامت المهارة محمّلة. وهي متاحة للقراءة ولا تُنفّذ أبدًا.

الأسئلة الشائعة

ماذا تفعل مهارة الذكاء الاصطناعي Devvn Html To Wp Acf؟

Convert static HTML landing pages into WordPress page templates with ACF (Advanced Custom Fields) or SCF (Secure Custom Fields) integration. Covers field registration via PHP, template conversion with get_field/have_rows, CSS minification, asset stripping, and page speed optimization.

لماذا تستخدم Devvn Html To Wp Acf على TypingMind؟

لأنك تثبّتها مرة واحدة وتستخدمها مع أي نموذج. مهارة Devvn Html To Wp Acf عبارة عن نص Markdown وليست شيفرة خاصة بمزود بعينه، لذا تعمل المهارة نفسها مع GPT-5 أو Claude أو Gemini أو Grok أو نموذج محلي، ويمكنك تبديل النموذج أثناء المحادثة دون تعطّل المهارة. يعمل TypingMind بمفاتيح API الخاصة بك، فتدفع للمزودين مباشرةً بدلًا من اشتراك لكل مقعد، وتبقى مهاراتك ومحادثاتك في مساحة التخزين الخاصة بك.

كيف أثبّت Devvn Html To Wp Acf في TypingMind؟

في TypingMind، افتح «الإضافات»، ثم «المهارات»، ثم اختر «التثبيت من GitHub» والصق https://github.com/levantoan/DevVN-WordPress-Skills/tree/main/skills/devvn-html-to-wp-acf. يقرأ TypingMind ملف SKILL.md الخاص بالمهارة، ويجمع ملفاتها ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Devvn Html To Wp Acf؟

أي نموذج تربطه في TypingMind. مهارات الذكاء الاصطناعي عبارة عن تعليمات Markdown وليست شيفرة خاصة بمزود بعينه، لذا يمكن لكل من GPT وClaude وGemini وGrok والنماذج المحلية تحميل هذه المهارة عندما يتوافق الطلب معها.

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Devvn Html To Wp Acf؟

أي عدد تريده. ما دام النموذج يدعم المهارات، يمكنك استخدام Devvn Html To Wp Acf معه، سواء كان GPT أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو غيرها، وكل ذلك على TypingMind باستخدام مفاتيح API الخاصة بك.

هل مهارة الذكاء الاصطناعي Devvn Html To Wp Acf مجانية؟

نشرها levantoan على GitHub. راجع المستودع للاطلاع على شروط الترخيص. لا تدفع إلا لمزود الذكاء الاصطناعي الخاص بك مقابل التوكنات التي تستخدمها.

ما هي مهارات الذكاء الاصطناعي؟

مهارة الذكاء الاصطناعي حزمة تعليمات قابلة لإعادة الاستخدام تعلّم نموذج الذكاء الاصطناعي كيفية تنفيذ مهمة محددة. وتتبع تنسيق Agent Skills المفتوح: ملف SKILL.md يتضمن اسمًا ووصفًا، إلى جانب أي نصوص برمجية أو قوالب أو ملفات مرجعية قد يحتاج إليها النموذج. لا يقرأ النموذج التعليمات إلا عندما يتوافق طلبك مع المهارة، لذا لا تترتب على المهارة المثبتة أي تكلفة حتى تُستخدم.

كيف تختلف مهارات الذكاء الاصطناعي عن الإضافات أو موصلات MCP؟

تمنح الإضافة أو موصل MCP النموذج أدوات جديدة يمكنه استدعاؤها، وهي شيفرة تُنفَّذ في مكان ما وتُرجع نتيجة. أما مهارة الذكاء الاصطناعي فتزوّد النموذج بالمعرفة ومنهجية العمل: كيفية التعامل مع مهمة، والخطوات التي ينبغي اتباعها، وما ينبغي أن تكون عليه المخرجات الجيدة. المهارات عبارة عن نصوص Markdown، لذا لا تحتاج إلى خادم أو مفتاح API أو بيئة تشغيل، وتعمل مع أي نموذج.

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا الإخبارية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇