{"id":906,"date":"2026-02-26T23:04:00","date_gmt":"2026-02-26T23:04:00","guid":{"rendered":"https:\/\/salvationrevolution.com\/blog\/?page_id=906"},"modified":"2026-03-01T23:08:46","modified_gmt":"2026-03-01T23:08:46","slug":"testimonials","status":"publish","type":"page","link":"https:\/\/salvationrevolution.com\/blog\/testimonials\/","title":{"rendered":"Testimonials"},"content":{"rendered":"\n<div id=\"sr-testimonials-wrap\" style=\"max-width:800px; margin:0 auto; font-family: inherit;\">\n  <h2 style=\"text-align:center; margin-bottom:30px; color:#000;\">Testimonials<\/h2>\n  <div id=\"sr-testimonials-container\"><\/div>\n  <div style=\"display:flex; justify-content:center; align-items:center; gap:15px; margin-top:20px;\">\n    <button id=\"sr-prev\" style=\"display:none; padding:10px 20px; background:#ff69b4; color:#fff; border:none; border-radius:5px; cursor:pointer; font-size:0.95em;\">\u2190 Previous<\/button>\n    <span id=\"sr-page-info\" style=\"color:#ff69b4; line-height:40px;\"><\/span>\n    <button id=\"sr-next\" style=\"display:none; padding:10px 20px; background:#ff69b4; color:#fff; border:none; border-radius:5px; cursor:pointer; font-size:0.95em;\">Next \u2192<\/button>\n  <\/div>\n  <p style=\"text-align:center; margin-top:20px;\">\n    <a href=\"https:\/\/salvationrevolution.com\/testimonials.php\" style=\"display:inline-block; padding:10px 24px; background:#ff69b4; color:#fff; text-decoration:none; border-radius:5px; font-size:0.95em;\">Share Your Experience<\/a>\n  <\/p>\n<\/div>\n\n<script>\n(function () {\n  let currentPage = 1;\n  const perPage = 5;\n  const API = 'https:\/\/salvationrevolution.com\/get_testimonials.php';\n\nfunction sanitize(text) {\n  const txt = document.createElement('textarea');\n  txt.innerHTML = text;\n  return txt.value;\n}\n\nfunction formatTestimonial(text) {\n  text = sanitize(text);\n\n  \/\/ If the text already contains HTML tags or manual line breaks, render as-is\n  if (\/<[a-z][\\s\\S]*>\/i.test(text) || text.includes('\\n')) {\n    return `<div style=\"line-height:1.8; color:#000;\">${text}<\/div>`;\n  }\n\n  \/\/ No HTML or line breaks \u2014 split into sentences and group into paragraphs of ~3\n  const sentenceEnders = \/([.!?]+)\\s+\/g;\n  const sentences = [];\n  let last = 0;\n  let match;\n\n  while ((match = sentenceEnders.exec(text)) !== null) {\n    sentences.push(text.slice(last, match.index + match[1].length).trim());\n    last = match.index + match[0].length;\n  }\n  if (last < text.length) sentences.push(text.slice(last).trim());\n\n  const paragraphs = [];\n  for (let i = 0; i < sentences.length; i += 3) {\n    paragraphs.push(sentences.slice(i, i + 3).join(' '));\n  }\n\n  return paragraphs\n    .filter(p => p.length > 0)\n    .map(p => `<p style=\"margin-bottom:12px; line-height:1.8; color:#000;\">${p}<\/p>`)\n    .join('');\n}\n\n  function loadTestimonials(page) {\n    const container = document.getElementById('sr-testimonials-container');\n    container.innerHTML = '<p style=\"text-align:center; color:#000; opacity:0.6;\">Loading testimonials...<\/p>';\n\n    fetch(`${API}?page=${page}&per_page=${perPage}`)\n      .then(r => r.json())\n      .then(data => {\n        container.innerHTML = '';\n\n        if (data.status !== 'success') {\n          container.innerHTML = '<p style=\"color:#000;\">Could not load testimonials. Please try again later.<\/p>';\n          return;\n        }\n\n        if (data.testimonials.length === 0) {\n          container.innerHTML = '<p style=\"text-align:center; color:#000;\">No testimonials yet. Be the first to share your experience!<\/p>';\n          return;\n        }\n\n        data.testimonials.forEach(t => {\n          const date = new Date(t.date_submitted).toLocaleDateString('en-US', {\n            year: 'numeric', month: 'long', day: 'numeric'\n          });\n\n          const div = document.createElement('div');\n          div.style.cssText = [\n            'background: transparent',\n            'padding: 24px',\n            'margin-bottom: 24px',\n            'border-radius: 10px',\n            'border: 2px solid #ff69b4',\n          ].join(';');\n\n          div.innerHTML = `\n            <div style=\"margin-bottom:14px;\">\n              ${formatTestimonial(t.testimonial)}\n            <\/div>\n            <div style=\"color:#ff69b4; font-style:italic; border-top:1px solid #ff69b4; padding-top:10px; margin-top:10px;\">\n              \u2014 ${t.name}\n              <span style=\"color:#ff69b4; opacity:0.75; font-size:0.88em; font-style:normal;\"> \u00b7 ${date}<\/span>\n            <\/div>\n          `;\n\n          container.appendChild(div);\n        });\n\n        const { current_page, total_pages } = data.pagination;\n        document.getElementById('sr-prev').style.display = current_page > 1 ? 'inline-block' : 'none';\n        document.getElementById('sr-next').style.display = current_page < total_pages ? 'inline-block' : 'none';\n        document.getElementById('sr-page-info').textContent =\n          total_pages > 1 ? `Page ${current_page} of ${total_pages}` : '';\n        currentPage = current_page;\n      })\n      .catch(() => {\n        container.innerHTML = '<p style=\"text-align:center; color:#000;\">Error loading testimonials. Please try again later.<\/p>';\n      });\n  }\n\n  document.getElementById('sr-prev').addEventListener('click', () => {\n    if (currentPage > 1) loadTestimonials(currentPage - 1);\n  });\n  document.getElementById('sr-next').addEventListener('click', () => {\n    loadTestimonials(currentPage + 1);\n  });\n\n  loadTestimonials(1);\n})();\n<\/script>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Testimonials \u2190 Previous Next \u2192 Share Your Experience<\/p>\n","protected":false},"author":1,"featured_media":306,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"disabled","ast-breadcrumbs-content":"","ast-featured-img":"disabled","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"class_list":["post-906","page","type-page","status-publish","has-post-thumbnail","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/salvationrevolution.com\/blog\/wp-json\/wp\/v2\/pages\/906","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/salvationrevolution.com\/blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/salvationrevolution.com\/blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/salvationrevolution.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/salvationrevolution.com\/blog\/wp-json\/wp\/v2\/comments?post=906"}],"version-history":[{"count":0,"href":"https:\/\/salvationrevolution.com\/blog\/wp-json\/wp\/v2\/pages\/906\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/salvationrevolution.com\/blog\/wp-json\/wp\/v2\/media\/306"}],"wp:attachment":[{"href":"https:\/\/salvationrevolution.com\/blog\/wp-json\/wp\/v2\/media?parent=906"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}