// Yahweh Mission Dashboard Integration — WPCode snippet version // Paste this into a new PHP Snippet in WPCode, set to run "Auto Insert" / // "Everywhere", and activate it. Functionally identical to the plugin // version — just packaged as a snippet since this host strips .php files // out of uploaded plugin zips. if (!function_exists('ymi_get_api_url')) { function ymi_get_api_url() { return rtrim(get_option('ymi_dashboard_api_url', ''), '/'); } } // ---- Settings page: Settings -> Yahweh Mission ---- add_action('admin_menu', function () { add_options_page('Yahweh Mission Dashboard', 'Yahweh Mission', 'manage_options', 'yahweh-mission', 'ymi_render_settings_page'); }); add_action('admin_init', function () { register_setting('ymi_settings', 'ymi_dashboard_api_url', array( 'sanitize_callback' => 'esc_url_raw', 'default' => '', )); }); function ymi_render_settings_page() { if (!current_user_can('manage_options')) { return; } $api_url = get_option('ymi_dashboard_api_url', ''); ?>

Yahweh Mission Dashboard

Connects this site to the Yahweh Mission Dashboard so published children, gifts, and projects appear here automatically via the [ymi_children], [ymi_gift_catalog], and [ymi_child_profile] shortcodes.

The base URL where the Yahweh Mission Dashboard is deployed — no trailing slash.

Connection check

8)); if (is_wp_error($response)) { echo '

Could not reach the dashboard: ' . esc_html($response->get_error_message()) . '

'; } elseif (wp_remote_retrieve_response_code($response) === 200) { echo '

Connected — the dashboard responded successfully.

'; } else { echo '

Dashboard responded with HTTP ' . esc_html(wp_remote_retrieve_response_code($response)) . '.

'; } ?>
.ymi-children-grid,.ymi-gift-grid{--ymi-navy:#0b1e3d;--ymi-blue:#2454d9;--ymi-blue-soft:#e4ecfc;--ymi-sea:#1fa6c9;--ymi-grey:#64748b;--ymi-line:#dde3ea;display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:20px;margin:24px 0;} .ymi-child-card{display:flex;flex-direction:column;background:#fff;border:1px solid var(--ymi-line);border-radius:10px;overflow:hidden;text-decoration:none;color:inherit;transition:box-shadow .15s ease;} .ymi-child-card:hover{box-shadow:0 4px 16px rgba(11,30,61,.1);} .ymi-child-card__photo{aspect-ratio:1/1;background:var(--ymi-blue-soft);display:flex;align-items:center;justify-content:center;overflow:hidden;} .ymi-child-card__photo img{width:100%;height:100%;object-fit:cover;} .ymi-child-card__initial{font-size:2.5rem;font-weight:600;color:var(--ymi-blue);} .ymi-child-card__body{padding:14px 16px;} .ymi-child-card__name{margin:0 0 4px;font-size:1.05rem;color:var(--ymi-navy);} .ymi-child-card__meta{margin:0 0 8px;font-size:.85rem;color:var(--ymi-grey);} .ymi-child-card__bio{margin:0;font-size:.85rem;color:var(--ymi-navy);opacity:.8;} .ymi-child-profile{--ymi-navy:#0b1e3d;--ymi-blue:#2454d9;--ymi-blue-soft:#e4ecfc;--ymi-grey:#64748b;display:grid;grid-template-columns:minmax(220px,280px) 1fr;gap:32px;margin:24px 0;} .ymi-child-profile__photo{aspect-ratio:1/1;background:var(--ymi-blue-soft);border-radius:10px;display:flex;align-items:center;justify-content:center;overflow:hidden;} .ymi-child-profile__photo img{width:100%;height:100%;object-fit:cover;} .ymi-child-profile__cta{margin-top:20px;} .ymi-gift-card{background:#fff;border:1px solid var(--ymi-line);border-radius:10px;padding:18px 20px;display:flex;flex-direction:column;} .ymi-gift-card__category{font-size:.72rem;text-transform:uppercase;letter-spacing:.05em;color:var(--ymi-sea);font-weight:700;} .ymi-gift-card__name{margin:6px 0 8px;color:var(--ymi-navy);} .ymi-gift-card__description{flex:1;font-size:.88rem;color:var(--ymi-grey);margin:0 0 16px;} .ymi-gift-card__footer{display:flex;align-items:center;justify-content:space-between;gap:12px;} .ymi-gift-card__price{font-weight:700;color:var(--ymi-navy);} .ymi-btn{display:inline-flex;align-items:center;justify-content:center;padding:8px 16px;border-radius:6px;background:var(--ymi-blue,#2454d9);color:#fff!important;text-decoration:none;font-weight:600;font-size:.9rem;} .ymi-btn--outline{background:transparent;border:1px solid var(--ymi-blue,#2454d9);color:var(--ymi-blue,#2454d9)!important;} .ymi-notice{background:#fdf6d8;border:1px solid #e8d98a;border-radius:6px;padding:10px 14px;font-size:.9rem;} .ymi-empty{color:#64748b;font-style:italic;} @media (max-width:640px){.ymi-child-profile{grid-template-columns:1fr;}} '; }); // ---- API client (cached) ---- if (!function_exists('ymi_api_get')) { function ymi_api_get($path, $cache_key, $ttl = 300) { $base = ymi_get_api_url(); if (empty($base)) { return new WP_Error('ymi_not_configured', 'The Yahweh Mission Dashboard URL has not been configured yet. Set it under Settings -> Yahweh Mission.'); } $cached = get_transient($cache_key); if ($cached !== false) { return $cached; } $response = wp_remote_get($base . $path, array('timeout' => 10)); if (is_wp_error($response)) { return $response; } if (wp_remote_retrieve_response_code($response) !== 200) { return new WP_Error('ymi_bad_response', 'The dashboard returned an unexpected response.'); } $data = json_decode(wp_remote_retrieve_body($response), true); if (!is_array($data)) { return new WP_Error('ymi_bad_json', 'The dashboard response could not be read.'); } set_transient($cache_key, $data, $ttl); return $data; } } if (!function_exists('ymi_not_configured_notice')) { function ymi_not_configured_notice() { if (current_user_can('manage_options')) { return '

The Yahweh Mission Dashboard is not connected yet. Configure it in Settings.

'; } return ''; } } if (!function_exists('ymi_error_notice')) { function ymi_error_notice($error) { if (current_user_can('manage_options')) { return '

Could not load content from the dashboard: ' . esc_html($error->get_error_message()) . '

'; } return ''; } } // ---- [ymi_children] ---- add_shortcode('ymi_children', function ($atts) { $atts = shortcode_atts(array('limit' => 0), $atts, 'ymi_children'); $children = ymi_api_get('/api/children?gender=either&country=all&minAge=1&maxAge=22', 'ymi_children_all'); if (is_wp_error($children)) { return $children->get_error_code() === 'ymi_not_configured' ? ymi_not_configured_notice() : ymi_error_notice($children); } if ((int) $atts['limit'] > 0) { $children = array_slice($children, 0, (int) $atts['limit']); } if (empty($children)) { return '

No children are currently available for sponsorship.

'; } ob_start(); ?>
<?php echo esc_attr($child['name']); ?>

yrs ·

''), $atts, 'ymi_child_profile'); $id = !empty($atts['id']) ? $atts['id'] : (isset($_GET['ymi_child']) ? sanitize_text_field(wp_unslash($_GET['ymi_child'])) : ''); if (empty($id)) { return '

No child specified.

'; } $api_url = ymi_get_api_url(); if (empty($api_url)) { return ymi_not_configured_notice(); } $cache_key = 'ymi_child_' . md5($id); $child = get_transient($cache_key); if ($child === false) { $response = wp_remote_get($api_url . '/api/children/' . rawurlencode($id), array('timeout' => 10)); if (is_wp_error($response)) { return ymi_error_notice($response); } if (wp_remote_retrieve_response_code($response) !== 200) { return '

This child profile is no longer available.

'; } $child = json_decode(wp_remote_retrieve_body($response), true); set_transient($cache_key, $child, 300); } if (!is_array($child)) { return '

This child profile is no longer available.

'; } ob_start(); ?>
<?php echo esc_attr($child['name']); ?>

yrs ·

Sponsor

already has a sponsor. Thank you!

get_error_code() === 'ymi_not_configured' ? ymi_not_configured_notice() : ymi_error_notice($gifts); } if (empty($gifts)) { return '

No gifts are available right now.

'; } $api_url = ymi_get_api_url(); ob_start(); ?>

Sponsor a Child

Content coming soon.

FAQ

What does Yahweh Mission International do?

Yahweh Mission International is a faith-based humanitarian nonprofit dedicated to helping children, women, families, and vulnerable communities move from poverty toward hope, dignity, and opportunity. Our work focuses on child education, food and nutrition, medical support, family care, emergency relief, and long-term community development.

Child sponsorship allows you to support a child in need through consistent care. Your sponsorship can help provide access to education, school supplies, meals, medical support, spiritual encouragement, and life-changing opportunities. It is more than a donation — it is a personal way to invest in a child’s future.

Your donation supports verified mission projects that directly serve children and families facing poverty, hardship, and crisis. Funds may be used for school support, food programs, healthcare needs, women’s care, family assistance, emergency relief, or community development, depending on the most urgent needs.

Yes. You can give a one-time donation, monthly gift, project-based donation, or child sponsorship gift. Every contribution matters, whether it helps provide a meal, pay for school materials, support medical care, or bring hope to a family in need.

Yes. When possible, sponsors and donors may receive updates such as photos, thank-you messages, progress stories, or project reports. We want every supporter to see the real impact of their generosity and understand how their giving is changing lives.

You can get involved by sponsoring a child, making a donation, praying for our mission, partnering with us, volunteering, or sharing our work with others. Whether you give, pray, serve, or advocate, you become part of a global movement bringing hope to children and communities in need.

FAQ

Have questions about how Yahweh Mission International works? Learn how your support helps children, families, and vulnerable communities through education, food, medical care, child sponsorship, and faith-based humanitarian programs around the world.

Have more questions ?

We would love to hear from you. Whether you want to sponsor a child, support a project, partner with our mission, or learn more about how your donation creates real impact, our team is here to help. Button: Sponsor a Child