<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>shortcodes &#8211; Blog</title>
	<atom:link href="https://blog.sergiorios.com.ar/tag/shortcodes/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.sergiorios.com.ar</link>
	<description>Investigación y Desarrollo, Tecnologías Web &#38; Cloud</description>
	<lastBuildDate>Mon, 23 Feb 2026 12:12:13 +0000</lastBuildDate>
	<language>es-AR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>https://blog.sergiorios.com.ar/wp-content/uploads/2024/10/cropped-favicon-32x32.png</url>
	<title>shortcodes &#8211; Blog</title>
	<link>https://blog.sergiorios.com.ar</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>🧩Integración avanzada WHMCS + WordPress</title>
		<link>https://blog.sergiorios.com.ar/trabajo/integracion-whmcs-wordpress-whmpress-personalizacion/</link>
		
		<dc:creator><![CDATA[sergio]]></dc:creator>
		<pubDate>Wed, 25 Jun 2025 15:09:51 +0000</pubDate>
				<category><![CDATA[Experiencia]]></category>
		<category><![CDATA[Trabajo]]></category>
		<category><![CDATA[moneda]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[shortcodes]]></category>
		<category><![CDATA[whmcs]]></category>
		<category><![CDATA[whmpress]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">https://blog.sergiorios.com.ar/?p=179</guid>

					<description><![CDATA[👉 En este artículo te muestro cómo hice una integración entre WordPress y WHMCS usando el plugin WHMpress, agregando lógica personalizada en PHP para detectar la moneda según la IP del visitante, mantenerla en sesión, permitir que el usuario la cambie manualmente y mostrar una banderita al lado 👇 ⚙️ ¿Qué es WHMpress? WHMpress es &#8230; <a href="https://blog.sergiorios.com.ar/trabajo/integracion-whmcs-wordpress-whmpress-personalizacion/" class="more-link">Continuá leyendo <span class="screen-reader-text">🧩Integración avanzada WHMCS + WordPress</span></a>]]></description>
										<content:encoded><![CDATA[
<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f449.png" alt="👉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> En este artículo te muestro cómo hice una integración entre <strong>WordPress</strong> y <strong>WHMCS</strong> usando el plugin <strong>WHMpress</strong>, agregando lógica personalizada en PHP para detectar la moneda según la IP del visitante, mantenerla en sesión, permitir que el usuario la cambie manualmente y mostrar una banderita al lado <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2699.png" alt="⚙" class="wp-smiley" style="height: 1em; max-height: 1em;" /> ¿Qué es WHMpress?</h2>



<p><a>WHMpress</a> es un plugin premium que permite conectar <strong>WordPress</strong> con <strong>WHMCS</strong>, ideal si vendés servicios como hosting, dominios o VPS.</p>



<p>Con WHMpress podés mostrar productos y precios de WHMCS directamente en WordPress, usando shortcodes o widgets.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f9e0.png" alt="🧠" class="wp-smiley" style="height: 1em; max-height: 1em;" /> ¿Cuál era la necesidad?</h2>



<p>Una empresa de IT necesitaba que:</p>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f30d.png" alt="🌍" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Los precios se muestren en la moneda del país del visitante (por IP).<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f9d1-200d-1f4bb.png" alt="🧑‍💻" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Si el usuario cambia la moneda manualmente, se respete su elección.<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f3c1.png" alt="🏁" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Agregar una banderita (o ícono) al lado del precio, según la moneda.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f9e9.png" alt="🧩" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Solución técnica</h2>



<p>A continuación te comparto los <strong>shortcodes</strong> y funciones personalizadas que agregué al archivo <code>functions.php</code> del theme:</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f50d.png" alt="🔍" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 1. Mostrar la IP del visitante</h3>



<pre class="wp-block-preformatted has-white-color has-dark-gray-background-color has-text-color has-background has-link-color has-small-font-size wp-elements-53f8341b99e4463b5075a3067cd759a0"><code>function shortcode_ip_cliente() {<br>    $ip = $_SERVER['HTTP_CF_CONNECTING_IP'] ?? <br>          $_SERVER['HTTP_X_FORWARDED_FOR'] ?? <br>          $_SERVER['REMOTE_ADDR'] ?? 'IP no detectada';<br>    return esc_html($ip);<br>}<br>add_shortcode('ip_cliente', 'shortcode_ip_cliente');<br></code></pre>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f449.png" alt="👉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Uso: <code>[ip_cliente]</code><br>Esto permite debuggear o ver desde qué IP se está accediendo.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f30e.png" alt="🌎" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 2. Detectar moneda por IP o por URL</h3>



<pre class="wp-block-preformatted has-white-color has-dark-gray-background-color has-text-color has-background has-link-color has-small-font-size wp-elements-dcde2e15900339921838d2762781ee2f"><code>add_action('init', 'whmpress_definir_moneda_por_url_o_ip');<br><br>function whmpress_definir_moneda_por_url_o_ip() {<br>    if (!session_id()) session_start();<br><br>    $monedas = ['USD' => 1, 'ARS' => 2];<br><br>    if (isset($_GET['currency']) &amp;&amp; isset($monedas[strtoupper($_GET['currency'])])) {<br>        $_SESSION['whmpress_currency'] = $monedas[strtoupper($_GET['currency'])];<br>        setcookie('whmpress_currency', $_SESSION['whmpress_currency'], time() + 86400 * 30, "/");<br>        return;<br>    }<br><br>    if (!isset($_SESSION['whmpress_currency']) &amp;&amp; isset($_COOKIE['whmpress_currency'])) {<br>        $_SESSION['whmpress_currency'] = $_COOKIE['whmpress_currency'];<br>        return;<br>    }<br><br>    if (!isset($_SESSION['whmpress_currency'])) {<br>        $ip = $_SERVER['REMOTE_ADDR'];<br>        $geo = @json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip={$ip}"));<br>        $pais = $geo->geoplugin_countryCode ?? 'US';<br>        $_SESSION['whmpress_currency'] = ($pais === 'AR') ? $monedas['ARS'] : $monedas['USD'];<br>        setcookie('whmpress_currency', $_SESSION['whmpress_currency'], time() + 86400 * 30, "/");<br>    }<br>}<br></code></pre>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f446.png" alt="👆" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Este fragmento detecta automáticamente la moneda inicial según la IP o parámetro <code>?currency=USD</code>.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f504.png" alt="🔄" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 3. Selector visual de moneda</h3>



<pre class="wp-block-preformatted has-white-color has-dark-gray-background-color has-text-color has-background has-link-color has-small-font-size wp-elements-1fe40cded2edea24f28a0688508f3fa6"><code>function selector_moneda() {<br>    if (!session_id()) session_start();<br><br>    // lógica reducida para claridad...<br>    $currency_num = $_COOKIE['whmpress_currency'] ?? $_SESSION['whmpress_currency'] ?? 1;<br><br>    if ($currency_num === '1') {<br>        $currency = 'USD'; $currency2 = 'ARS'; $icon1 = '&#x1f310;'; $icon2 = '&#x1f1e6;&#x1f1f7;';<br>    } else {<br>        $currency = 'ARS'; $currency2 = 'USD'; $icon1 = '&#x1f1e6;&#x1f1f7;'; $icon2 = '&#x1f310;';<br>    }<br><br>    $html = '&lt;select onchange="if(this.value) location=this.value;">';<br>    $html .= "&lt;option value='?currency={$currency}' selected>{$icon1} {$currency}&lt;/option>";<br>    $html .= "&lt;option value='?currency={$currency2}'>{$icon2} {$currency2}&lt;/option>";<br>    $html .= '&lt;/select>';<br><br>    return $html;<br>}<br>add_shortcode('selector_moneda', 'selector_moneda');<br></code></pre>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f449.png" alt="👉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Uso: <code>[selector_moneda]</code><br>Esto genera un pequeño dropdown para cambiar de moneda manualmente. Ideal para la cabecera del sitio.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f3c1.png" alt="🏁" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 4. Mostrar una banderita según la moneda</h3>



<pre class="wp-block-preformatted has-white-color has-dark-gray-background-color has-text-color has-background has-link-color has-small-font-size wp-elements-4299b81b41ff10ab49de521e128a9ecf"><code>function mostrar_bandera_por_moneda() {<br>    if (session_status() == PHP_SESSION_NONE) session_start();<br>    $currency = $_SESSION['whmpress_currency'] ?? null;<br><br>    if ($currency == '2') {<br>        return '&lt;img src="https://flagcdn.com/w40/ar.png" alt="Argentina" width="24" height="18">';<br>    } elseif ($currency == '1') {<br>        return '&lt;span style="font-size:24px;">&#x1f310;&lt;/span>';<br>    }<br>    return '';<br>}<br>add_shortcode('moneda_bandera', 'mostrar_bandera_por_moneda');<br></code></pre>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f449.png" alt="👉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Uso: <code>[moneda_bandera]</code><br>Se puede usar al lado del precio o del selector para que sea más visual <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f5bc.png" alt="🖼" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2728.png" alt="✨" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Resultado final</h2>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Precios dinámicos según país<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Cambios manuales de moneda respetados<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Visualización con íconos o banderas<br><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Todo usando <strong>shortcodes simples</strong> en WordPress</p>



<p></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
