<?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>Tutoriels - Themespress</title>
	<atom:link href="https://themespress.ca/categorie/tutoriels/feed/" rel="self" type="application/rss+xml" />
	<link>https://themespress.ca</link>
	<description>Des tutoriels et ressources WordPress</description>
	<lastBuildDate>Thu, 06 Aug 2026 12:38:32 +0000</lastBuildDate>
	<language>fr-FR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.2</generator>

<image>
	<url>https://themespress.ca/wp-content/uploads/2020/10/cropped-Favicon-Themepress.ca_-32x32.png</url>
	<title>Tutoriels - Themespress</title>
	<link>https://themespress.ca</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Paniers actifs des clients – WooCommerce</title>
		<link>https://themespress.ca/paniers-actifs-des-clients-woocommerce/</link>
					<comments>https://themespress.ca/paniers-actifs-des-clients-woocommerce/#respond</comments>
		
		<dc:creator><![CDATA[Themespress]]></dc:creator>
		<pubDate>Thu, 06 Aug 2026 10:29:16 +0000</pubDate>
				<category><![CDATA[Tutoriels]]></category>
		<guid isPermaLink="false">https://themespress.ca/?p=8819</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<div class="wpb-content-wrapper"><div class="vc_row wpb_row vc_row-fluid"><div class="wpb_column vc_column_container vc_col-sm-12"><div class="vc_column-inner"><div class="wpb_wrapper">
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p class="PDq2pG_selectionAnchorContainer" data-start="199" data-end="315">Consultez rapidement tous les paniers actifs de votre boutique WooCommerce directement depuis votre tableau de bord.</p>
<p data-start="317" data-end="533">Ce module vous permet de visualiser les <strong>paniers actuellement enregistrés des clients</strong>, d&#8217;effectuer des recherches avancées, d&#8217;exporter les données et de maintenir la liste à jour grâce à un rafraîchissement manuel ou automatique.</p>

		</div>
	</div>
<h2 style="text-align: left" class="vc_custom_heading vc_do_custom_heading" >Fonctionnalités des paniers actifs des clients - Woocommerce</h2><div class="vc_empty_space"   style="height: 22px"><span class="vc_empty_space_inner"></span></div>
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<ul>
<li data-section-id="17rquou" data-start="555" data-end="610">Affichage des paniers actifs des clients WooCommerce.</li>
<li data-section-id="1njv948" data-start="611" data-end="674">Affichage de la <strong data-start="629" data-end="673">date d&#8217;ajout des produits dans le panier</strong>.</li>
<li data-section-id="xiupru" data-start="675" data-end="720">Filtres par <strong data-start="689" data-end="719">montant minimum et maximum</strong>.</li>
<li data-section-id="1ko9xpr" data-start="721" data-end="754">Filtres par <strong data-start="735" data-end="753">plage de dates</strong>.</li>
<li data-section-id="9hepne" data-start="755" data-end="798">Recherche instantanée dans les résultats.</li>
<li data-section-id="10ssjmd" data-start="799" data-end="838">Export des données au format <strong data-start="830" data-end="837">CSV</strong>.</li>
<li data-section-id="18wfns4" data-start="839" data-end="880">Export des données au format <strong data-start="870" data-end="879">Excel</strong>.</li>
<li data-section-id="1qr1jol" data-start="881" data-end="952">Bouton <strong data-start="890" data-end="907">Refresh Carts</strong> pour mettre à jour les données à la demande.</li>
<li data-section-id="1gk5v5a" data-start="953" data-end="1022">Rafraîchissement automatique des paniers toutes les <strong data-start="1007" data-end="1021">10 minutes</strong>.</li>
</ul>

		</div>
	</div>
<h2 style="text-align: left" class="vc_custom_heading vc_do_custom_heading" >Pourquoi utiliser ce module tout prêt ?</h2><div class="vc_empty_space"   style="height: 22px"><span class="vc_empty_space_inner"></span></div>
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p><strong>Les statistiques natives de WooCommerce</strong> se concentrent principalement sur les commandes finalisées. Avec Paniers actifs des clients, vous obtenez une vue des paniers actuellement enregistrés afin de suivre l&#8217;activité de votre boutique en temps réel.</p>
<p>Grâce aux filtres et aux options d&#8217;exportation, il devient facile d&#8217;analyser les paniers actifs ou de récupérer les données pour vos propres rapports.</p>

		</div>
	</div>

	<div class="wpb_text_column wpb_content_element panier-promo" >
		<div class="wpb_wrapper">
			<p>&#x1f680; Besoin d&#8217;afficher vos paniers actifs WooCommerce directement dans votre administration ?<br data-start="600" data-end="603" /><strong>Découvrez notre code tout prêt à insérer dans votre thème</strong>, et qui permet de suivre les produits présents dans les paniers clients, la quantité totale et la valeur des <strong>paniers en temps réel</strong>.</p>

		</div>
	</div>

	<div class="wpb_raw_code wpb_raw_html wpb_content_element read-more" >
		<div class="wpb_wrapper">
			<a class="button-secondary btn btn-color-2 btn-border-color-1" href="https://themespress.ca/produits/le-pret-a-lemploi/paniers-actifs-des-clients-woocommerce/">Télécharger</a>
		</div>
	</div>
<h2 style="text-align: left" class="vc_custom_heading vc_do_custom_heading" >Une interface simple et efficace</h2><div class="vc_empty_space"   style="height: 22px"><span class="vc_empty_space_inner"></span></div>
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>Le module s&#8217;intègre directement dans l&#8217;administration WooCommerce et offre une interface claire permettant de consulter rapidement les paniers actifs, d&#8217;appliquer des filtres, d&#8217;exporter les résultats et de rafraîchir les informations en un seul clic.</p>
<p>L&#8217;actualisation automatique toutes les 10 minutes garantit également que les données restent à jour sans intervention manuelle.</p>

		</div>
	</div>

	<div  class="wpb_single_image wpb_content_element vc_align_left wpb_content_element wpb_animate_when_almost_visible wpb_fadeInUp fadeInUp">
		
		<figure class="wpb_wrapper vc_figure">
			<a class="" data-lightbox="lightbox[rel-8819-2658233261]" href="https://themespress.ca/wp-content/uploads/2026/08/Paniers-actifs-des-clients-Woocommerce.jpg" target="_self" class="vc_single_image-wrapper   vc_box_border_grey"><img fetchpriority="high" decoding="async" width="971" height="1024" src="https://themespress.ca/wp-content/uploads/2026/08/Paniers-actifs-des-clients-Woocommerce.jpg" class="vc_single_image-img attachment-full" alt="Paniers actifs des clients - Woocommerce" title="Paniers actifs des clients - Woocommerce" srcset="https://themespress.ca/wp-content/uploads/2026/08/Paniers-actifs-des-clients-Woocommerce.jpg 971w, https://themespress.ca/wp-content/uploads/2026/08/Paniers-actifs-des-clients-Woocommerce-284x300.jpg 284w, https://themespress.ca/wp-content/uploads/2026/08/Paniers-actifs-des-clients-Woocommerce-768x810.jpg 768w, https://themespress.ca/wp-content/uploads/2026/08/Paniers-actifs-des-clients-Woocommerce-600x633.jpg 600w" sizes="(max-width: 971px) 100vw, 971px" /></a>
		</figure>
	</div>

	<div class="wpb_text_column wpb_content_element droits-images" >
		<div class="wpb_wrapper">
			<p class="PDq2pG_selectionAnchorContainer" data-start="2" data-end="52"><strong data-start="2" data-end="52" data-is-only-node="">Avis important concernant les captures d&#8217;écran</strong></p>
<p class="" data-start="57" data-end="489" data-is-last-node="">Les captures d&#8217;écran présentées sur cette page sont fournies uniquement à titre d&#8217;illustration. Les noms, adresses courriel, produits, montants et toutes les autres informations affichées ont été entièrement inventés ou générés à des fins de démonstration. Toute ressemblance avec des personnes, entreprises ou données réelles serait purement fortuite. Aucune information provenant de clients réels n&#8217;est utilisée dans ces exemples.</p>

		</div>
	</div>
</div></div></div></div>
</div><p>The post <a href="https://themespress.ca/paniers-actifs-des-clients-woocommerce/">Paniers actifs des clients – WooCommerce</a> first appeared on <a href="https://themespress.ca">Themespress</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://themespress.ca/paniers-actifs-des-clients-woocommerce/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>WooCommerce : statistiques des paniers actifs</title>
		<link>https://themespress.ca/woocommerce-statistiques-des-paniers-actifs/</link>
					<comments>https://themespress.ca/woocommerce-statistiques-des-paniers-actifs/#respond</comments>
		
		<dc:creator><![CDATA[Themespress]]></dc:creator>
		<pubDate>Wed, 05 Aug 2026 19:00:42 +0000</pubDate>
				<category><![CDATA[Tutoriels]]></category>
		<guid isPermaLink="false">https://themespress.ca/?p=8801</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<div class="wpb-content-wrapper"><div class="vc_row wpb_row vc_row-fluid"><div class="wpb_column vc_column_container vc_col-sm-12"><div class="vc_column-inner"><div class="wpb_wrapper">
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<div class="wpb_text_column wpb_content_element">
<div class="wpb_wrapper">
<p class="isSelectedEnd">Dans ce tutoriel, nous allons voir comment calculer la quantité totale de produits actuellement présents dans les paniers actifs des utilisateurs WooCommerce ainsi que la valeur totale de tous les paniers en cours.</p>
<p class="isSelectedEnd">Les statistiques natives de WooCommerce permettent de suivre les commandes, les ventes et le chiffre d’affaires réalisé, mais elles ne donnent pas toujours une vision de l’activité commerciale en temps réel. Pourtant, les produits ajoutés aux paniers des visiteurs représentent une information importante pour analyser l’intérêt des clients et mesurer le potentiel de vente.</p>
<p>Grâce aux <strong>statistiques des paniers actifs WooCommerce</strong>, il devient possible de connaître le nombre total d’articles actuellement sélectionnés par les utilisateurs ainsi que la valeur financière globale de ces paniers avant leur conversion en commande.</p>
</div>
</div>
<div class="wpb_text_column wpb_content_element">
<div class="wpb_wrapper">
<p class="isSelectedEnd">Dans ce tutoriel, nous allons donc créer deux fonctions personnalisées :</p>
<ul data-spread="false">
<li>Calculer la quantité totale de produits présents dans tous les paniers actifs WooCommerce.</li>
<li>Calculer la valeur totale de tous les paniers actifs des utilisateurs.</li>
</ul>
</div>
</div>

		</div>
	</div>
</div></div></div></div><div class="vc_row wpb_row vc_row-fluid"><div class="wpb_column vc_column_container vc_col-sm-12"><div class="vc_column-inner"><div class="wpb_wrapper"><h2 style="text-align: left" class="vc_custom_heading vc_do_custom_heading" >Calculer la quantité totale de produits présents dans tous les paniers actifs WooCommerce.</h2><div class="vc_empty_space"   style="height: 22px"><span class="vc_empty_space_inner"></span></div><div id="ts-enlighterjs-container-7513253" class="ts-enlighterjs-container-single-enabled  " style="width: 100%;  margin-top: 0px; margin-bottom: 0px;" data-enlighter-doubleclick="true" data-enlighter-windowbutton="true" data-enlighter-windowtext="New Window" data-enlighter-rawbutton="true" data-enlighter-rawtext="RAW Code" data-enlighter-infobutton="false" data-enlighter-infotext="EnlighterJS" data-enlighter-indent="2"><pre id="ts-enlighterjs-pre-7513253" class="" style="white-space: pre-wrap; height: 100%; margin: 0; padding: 0;" data-enlighter-language="php" data-enlighter-theme="enlighter" data-enlighter-group="" data-enlighter-title="" data-enlighter-linenumbers="true" data-enlighter-lineoffset="1" data-enlighter-highlight="">/////////////////////////// Show count product in all carts  /////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////

function woocl_get_total_products_in_active_carts() {
    global $wpdb;

    // 1. On r&eacute;cup&egrave;re dynamiquement le bon ID du site (g&eacute;n&eacute;ralement 1)
    $blog_id = get_current_blog_id();
    $meta_key = &#039;_woocommerce_persistent_cart_&#039; . $blog_id;

    // 2. On ex&eacute;cute la requ&ecirc;te avec la bonne cl&eacute;
    $results = $wpdb-&gt;get_results($wpdb-&gt;prepare(&quot;
        SELECT meta_value 
        FROM {$wpdb-&gt;usermeta} 
        WHERE meta_key = %s AND meta_value != &#039;&#039;
    &quot;, $meta_key));

    $total = 0;

    if (!empty($results)) {
        foreach ($results as $row) {
            $cart_data = maybe_unserialize($row-&gt;meta_value);

            // 3. On v&eacute;rifie s&#039;il y a des produits et on additionne les quantit&eacute;s
            if (!empty($cart_data[&#039;cart&#039;]) &amp;&amp; is_array($cart_data[&#039;cart&#039;])) {
                foreach ($cart_data[&#039;cart&#039;] as $item) {
                    if (isset($item[&#039;quantity&#039;]) &amp;&amp; is_numeric($item[&#039;quantity&#039;])) {
                        $total += (int) $item[&#039;quantity&#039;];
                    }
                }
            }
        }
    }

    return $total;
}</pre></div></div></div></div></div><div class="vc_row wpb_row vc_row-fluid"><div class="wpb_column vc_column_container vc_col-sm-12"><div class="vc_column-inner"><div class="wpb_wrapper"><h2 style="text-align: left" class="vc_custom_heading vc_do_custom_heading" >Calculer la valeur totale de tous les paniers actifs des utilisateurs.</h2><div class="vc_empty_space"   style="height: 22px"><span class="vc_empty_space_inner"></span></div><div id="ts-enlighterjs-container-5776403" class="ts-enlighterjs-container-single-enabled  " style="width: 100%;  margin-top: 0px; margin-bottom: 0px;" data-enlighter-doubleclick="true" data-enlighter-windowbutton="true" data-enlighter-windowtext="New Window" data-enlighter-rawbutton="true" data-enlighter-rawtext="RAW Code" data-enlighter-infobutton="false" data-enlighter-infotext="EnlighterJS" data-enlighter-indent="2"><pre id="ts-enlighterjs-pre-5776403" class="" style="white-space: pre-wrap; height: 100%; margin: 0; padding: 0;" data-enlighter-language="php" data-enlighter-theme="enlighter" data-enlighter-group="" data-enlighter-title="" data-enlighter-linenumbers="true" data-enlighter-lineoffset="1" data-enlighter-highlight="">/////////////////////////// Show price amount in all carts  //////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////

function woocl_get_total_cart_amount_all_users() {
    global $wpdb;

    $blog_id = get_current_blog_id();
    $meta_key = &#039;_woocommerce_persistent_cart_&#039; . $blog_id;

    // R&eacute;cup&eacute;ration de toutes les lignes non vides
    $results = $wpdb-&gt;get_results($wpdb-&gt;prepare(&quot;
        SELECT meta_value 
        FROM {$wpdb-&gt;usermeta} 
        WHERE meta_key = %s AND meta_value != &#039;&#039;
    &quot;, $meta_key));

    $total_amount = 0;

    if (!empty($results)) {
        foreach ($results as $row) {
            $cart_data = maybe_unserialize($row-&gt;meta_value);

            // On v&eacute;rifie s&#039;il y a bien des &eacute;l&eacute;ments dans le panier (ex: a:2:{...} et non a:0:{})
            if (!empty($cart_data[&#039;cart&#039;]) &amp;&amp; is_array($cart_data[&#039;cart&#039;])) {
                
                foreach ($cart_data[&#039;cart&#039;] as $cart_item_key =&gt; $item) {
                    
                    // WooCommerce stocke TOUJOURS l&#039;ID dans &#039;product_id&#039; au sein de l&#039;&eacute;l&eacute;ment
                    $product_id = isset($item[&#039;product_id&#039;]) ? (int) $item[&#039;product_id&#039;] : 0;
                    $quantity = isset($item[&#039;quantity&#039;]) ? (int) $item[&#039;quantity&#039;] : 0;

                    if ($product_id &gt; 0 &amp;&amp; $quantity &gt; 0) {
                        $product = wc_get_product($product_id);
                        
                        if ($product) {
                            // Prise en compte du prix du produit (ou de la variation)
                            $price = (float) $product-&gt;get_price();
                            $total_amount += $price * $quantity;
                        }
                    }
                }
            }
        }
    }

    return wc_price($total_amount);
}</pre></div></div></div></div></div>
</div><p>The post <a href="https://themespress.ca/woocommerce-statistiques-des-paniers-actifs/">WooCommerce : statistiques des paniers actifs</a> first appeared on <a href="https://themespress.ca">Themespress</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://themespress.ca/woocommerce-statistiques-des-paniers-actifs/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Mettre à jour sa licence Formidable Forms Pro</title>
		<link>https://themespress.ca/mettre-a-jour-sa-licence-formidable-forms-pro/</link>
					<comments>https://themespress.ca/mettre-a-jour-sa-licence-formidable-forms-pro/#respond</comments>
		
		<dc:creator><![CDATA[Themespress]]></dc:creator>
		<pubDate>Wed, 14 Jan 2026 13:06:57 +0000</pubDate>
				<category><![CDATA[Tutoriels]]></category>
		<category><![CDATA[Base de données]]></category>
		<category><![CDATA[Clés Licenses Pro]]></category>
		<category><![CDATA[Formidable Form]]></category>
		<guid isPermaLink="false">https://themespress.ca/?p=8247</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<div class="wpb-content-wrapper"><div class="vc_row wpb_row vc_row-fluid"><div class="wpb_column vc_column_container vc_col-sm-12"><div class="vc_column-inner"><div class="wpb_wrapper">
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>Il arrive que Formidable Forms Pro ne détecte plus correctement une nouvelle clé de licence. Dans certains cas, la page Formidable → Settings affiche une page blanche. Par conséquent, l’utilisateur ne peut plus mettre à jour la licence depuis l’interface WordPress.</p>
<p>Dans cette situation, vous pouvez mettre à jour la licence directement dans la base de données, notamment via phpMyAdmin. En effet, WordPress stocke la clé de licence dans la table wp_options. Ainsi, lorsque l’administration ne répond plus, cette méthode vous permet de modifier la licence manuellement.</p>
<p>Cependant, vous devez utiliser cette manipulation uniquement comme solution de dépannage. Elle permet toutefois de corriger une licence bloquée ou mal enregistrée sans désinstaller le plugin ni perdre de données. Avant toute intervention, pensez donc à sauvegarder la base de données.</p>
<p>Une fois la licence mise à jour, la page <a href="https://formidableforms.com/" target="_blank" rel="noopener">Formidable</a> → Settings redevient généralement accessible. Dès lors, vous pouvez retourner dans les réglages Formidable et mettre à jour ou remplacer la clé de licence depuis l’interface WordPress. De cette manière, vous reprenez une gestion normale du plugin.</p>

		</div>
	</div>

	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<ul>
<li data-start="122" data-end="357">
<p data-start="125" data-end="357"><strong data-start="125" data-end="177">Mettre à jour la licence dans la base de données</strong><br data-start="177" data-end="180" />Lorsque la page <strong data-start="199" data-end="224">Formidable → Settings</strong> devient inaccessible (page blanche), la clé de licence peut être modifiée directement dans la table <code data-start="325" data-end="337">wp_options</code> via <strong data-start="342" data-end="356">phpMyAdmin</strong>.</p>
</li>
<li data-start="359" data-end="583">
<p data-start="362" data-end="583"><strong data-start="362" data-end="412">Rétablir l’accès à la page Formidable Settings</strong><br data-start="412" data-end="415" />Cette mise à jour permet généralement de <strong data-start="459" data-end="482">corriger le blocage</strong> et de rendre à nouveau accessible la page <strong data-start="525" data-end="550">Formidable → Settings</strong> dans l’administration WordPress.</p>
</li>
<li data-start="585" data-end="859">
<p data-start="588" data-end="859"><strong data-start="588" data-end="641">Mettre à jour la clé depuis l’interface WordPress</strong><br data-start="641" data-end="644" />Une fois la page rétablie, il est recommandé de <strong data-start="695" data-end="735">revenir dans les réglages <a href="https://formidableforms.com/" target="_blank" rel="noopener">Formidable</a></strong> et de <strong data-start="742" data-end="809">mettre à jour ou confirmer la clé de licence depuis l’interface</strong>, afin de reprendre une gestion normale du plugin.</p>
</li>
</ul>

		</div>
	</div>
<div id="ts-enlighterjs-container-8846593" class="ts-enlighterjs-container-single-enabled  " style="width: 100%;  margin-top: 0px; margin-bottom: 0px;" data-enlighter-doubleclick="true" data-enlighter-windowbutton="true" data-enlighter-windowtext="New Window" data-enlighter-rawbutton="true" data-enlighter-rawtext="RAW Code" data-enlighter-infobutton="false" data-enlighter-infotext="EnlighterJS" data-enlighter-indent="2"><pre id="ts-enlighterjs-pre-8846593" class="" style="white-space: pre-wrap; height: 100%; margin: 0; padding: 0;" data-enlighter-language="php" data-enlighter-theme="enlighter" data-enlighter-group="" data-enlighter-title="" data-enlighter-linenumbers="true" data-enlighter-lineoffset="1" data-enlighter-highlight="">UPDATE wp_options
SET option_value = &#039;a:1:{s:7:&quot;license&quot;;s:32:&quot;VOTRE CL&Eacute; API ICI&quot;;}&#039;
WHERE option_name = &#039;frmpro-credentials&#039;;
</pre></div><div class="vc_btn3-container vc_btn3-inline vc_do_btn" ><a class="vc_general vc_btn3 vc_btn3-size-md vc_btn3-shape-rounded vc_btn3-style-modern vc_btn3-color-warning" href="https://themespress.ca/?s=formidable" title="">Autres articles Formidable Form</a></div></div></div></div></div>
</div><p>The post <a href="https://themespress.ca/mettre-a-jour-sa-licence-formidable-forms-pro/">Mettre à jour sa licence Formidable Forms Pro</a> first appeared on <a href="https://themespress.ca">Themespress</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://themespress.ca/mettre-a-jour-sa-licence-formidable-forms-pro/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Calculer le coût moyen d&#8217;expédition par commande &#8211; Woocommerce</title>
		<link>https://themespress.ca/calculer-cout-expedition-commande-woocommerce/</link>
					<comments>https://themespress.ca/calculer-cout-expedition-commande-woocommerce/#respond</comments>
		
		<dc:creator><![CDATA[Themespress]]></dc:creator>
		<pubDate>Sat, 28 Oct 2023 20:24:44 +0000</pubDate>
				<category><![CDATA[Tutoriels]]></category>
		<guid isPermaLink="false">https://themespress.ca/?p=7492</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<div class="wpb-content-wrapper"><div class="vc_row wpb_row vc_row-fluid"><div class="wpb_column vc_column_container vc_col-sm-12"><div class="vc_column-inner"><div class="wpb_wrapper">
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>Nous allons dans ce tutoriel calculer le coût moyen des frais d&#8217;expédition par commande sur l&#8217;ensemble des commandes (y compris celles qui n&#8217;ont pas de frais de livraison), vous pouvez ajuster la fonction de la manière suivante</p>

		</div>
	</div>
<h2 style="text-align: left" class="vc_custom_heading vc_do_custom_heading" >Calculer le coût moyen des frais d'expédition - Toutes les commandes</h2><div id="ts-enlighterjs-container-3188185" class="ts-enlighterjs-container-single-enabled  " style="width: 100%;  margin-top: 0px; margin-bottom: 0px;" data-enlighter-doubleclick="true" data-enlighter-windowbutton="true" data-enlighter-windowtext="New Window" data-enlighter-rawbutton="true" data-enlighter-rawtext="RAW Code" data-enlighter-infobutton="false" data-enlighter-infotext="EnlighterJS" data-enlighter-indent="2"><pre id="ts-enlighterjs-pre-3188185" class="" style="white-space: pre-wrap; height: 100%; margin: 0; padding: 0;" data-enlighter-language="standard" data-enlighter-theme="enlighter" data-enlighter-group="" data-enlighter-title="" data-enlighter-linenumbers="true" data-enlighter-lineoffset="1" data-enlighter-highlight="">function woocl_calculate_average_shipping_cost_per_order_all_orders() {
    $args = array(
        &#039;status&#039; =&gt; array(&#039;wc-completed&#039;, &#039;wc-shipped&#039;),
        &#039;limit&#039; =&gt; -1,
        &#039;return&#039; =&gt; &#039;ids&#039;,
    );
    $shipped_orders = wc_get_orders($args);

    $total_shipping_cost = 0;
    $total_orders = count($shipped_orders);

    foreach ($shipped_orders as $order_id) {
        $order = wc_get_order($order_id);
        $shipping_total = (float) $order-&gt;get_shipping_total();
        $total_shipping_cost += $shipping_total;
    }

    if ($total_orders &gt; 0) {
        $average_shipping_cost_per_order = $total_shipping_cost / $total_orders;
    } else {
        $average_shipping_cost_per_order = 0;
    }

    return $average_shipping_cost_per_order;
}
</pre></div>
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>Maintenant nous souhaitons l&#8217;afficher dans notre template.</p>

		</div>
	</div>
<div id="ts-enlighterjs-container-8074266" class="ts-enlighterjs-container-single-enabled  " style="width: 100%;  margin-top: 0px; margin-bottom: 0px;" data-enlighter-doubleclick="true" data-enlighter-windowbutton="true" data-enlighter-windowtext="New Window" data-enlighter-rawbutton="true" data-enlighter-rawtext="RAW Code" data-enlighter-infobutton="false" data-enlighter-infotext="EnlighterJS" data-enlighter-indent="2"><pre id="ts-enlighterjs-pre-8074266" class="" style="white-space: pre-wrap; height: 100%; margin: 0; padding: 0;" data-enlighter-language="standard" data-enlighter-theme="enlighter" data-enlighter-group="" data-enlighter-title="" data-enlighter-linenumbers="true" data-enlighter-lineoffset="1" data-enlighter-highlight="">$average_shipping_cost_per_order = woocl_calculate_average_shipping_cost_per_order_all_orders();
echo &#039;Co&ucirc;t moyen d\&#039;exp&eacute;dition par commande (toutes les commandes): &#039; . wc_price($average_shipping_cost_per_order);
</pre></div><h2 style="text-align: left" class="vc_custom_heading vc_do_custom_heading" >Calculer le coût moyen des frais d'expédition - Commandes avec frais d'expédition</h2>
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>Maintenant, si vous voulez <strong>calculer le coût moyen des frais d&#8217;expédition uniquement pour les commandes</strong> qui ont <strong>effectivement des frais d&#8217;expédition</strong>, vous pouvez utiliser la fonction suivante:</p>

		</div>
	</div>
<div id="ts-enlighterjs-container-3404754" class="ts-enlighterjs-container-single-enabled  " style="width: 100%;  margin-top: 0px; margin-bottom: 0px;" data-enlighter-doubleclick="true" data-enlighter-windowbutton="true" data-enlighter-windowtext="New Window" data-enlighter-rawbutton="true" data-enlighter-rawtext="RAW Code" data-enlighter-infobutton="false" data-enlighter-infotext="EnlighterJS" data-enlighter-indent="2"><pre id="ts-enlighterjs-pre-3404754" class="" style="white-space: pre-wrap; height: 100%; margin: 0; padding: 0;" data-enlighter-language="standard" data-enlighter-theme="enlighter" data-enlighter-group="" data-enlighter-title="" data-enlighter-linenumbers="true" data-enlighter-lineoffset="1" data-enlighter-highlight="">function woocl_calculate_average_shipping_cost_for_orders_with_shipping() {
    $args = array(
        &#039;status&#039; =&gt; array(&#039;wc-completed&#039;, &#039;wc-shipped&#039;),
        &#039;limit&#039; =&gt; -1,
        &#039;return&#039; =&gt; &#039;ids&#039;,
    );
    $shipped_orders = wc_get_orders($args);

    $total_shipping_cost = 0;
    $orders_with_shipping = 0;

    foreach ($shipped_orders as $order_id) {
        $order = wc_get_order($order_id);
        $shipping_total = (float) $order-&gt;get_shipping_total();

        if ($shipping_total &gt; 0) {
            $total_shipping_cost += $shipping_total;
            $orders_with_shipping++;
        }
    }

    if ($orders_with_shipping &gt; 0) {
        $average_shipping_cost = $total_shipping_cost / $orders_with_shipping;
    } else {
        $average_shipping_cost = 0;
    }

    return $average_shipping_cost;
}
</pre></div>
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>Pour afficher le coût moyen d&#8217;expédition (Uniquement les Commandes avec Frais d&#8217;Expédition)</p>

		</div>
	</div>
<div id="ts-enlighterjs-container-5394634" class="ts-enlighterjs-container-single-enabled  " style="width: 100%;  margin-top: 0px; margin-bottom: 0px;" data-enlighter-doubleclick="true" data-enlighter-windowbutton="true" data-enlighter-windowtext="New Window" data-enlighter-rawbutton="true" data-enlighter-rawtext="RAW Code" data-enlighter-infobutton="false" data-enlighter-infotext="EnlighterJS" data-enlighter-indent="2"><pre id="ts-enlighterjs-pre-5394634" class="" style="white-space: pre-wrap; height: 100%; margin: 0; padding: 0;" data-enlighter-language="standard" data-enlighter-theme="enlighter" data-enlighter-group="" data-enlighter-title="" data-enlighter-linenumbers="true" data-enlighter-lineoffset="1" data-enlighter-highlight="">$average_shipping_cost = woocl_calculate_average_shipping_cost_for_orders_with_shipping();
echo &#039;Co&ucirc;t moyen d\&#039;exp&eacute;dition (uniquement les commandes avec frais d\&#039;exp&eacute;dition): &#039; . wc_price($average_shipping_cost);
</pre></div></div></div></div></div>
</div><p>The post <a href="https://themespress.ca/calculer-cout-expedition-commande-woocommerce/">Calculer le coût moyen d’expédition par commande – Woocommerce</a> first appeared on <a href="https://themespress.ca">Themespress</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://themespress.ca/calculer-cout-expedition-commande-woocommerce/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Souscriptions MemberPress &#8211; Compte client Woocommerce</title>
		<link>https://themespress.ca/souscriptions-memberpress-woocommerce/</link>
					<comments>https://themespress.ca/souscriptions-memberpress-woocommerce/#respond</comments>
		
		<dc:creator><![CDATA[Themespress]]></dc:creator>
		<pubDate>Sat, 23 Sep 2023 15:55:12 +0000</pubDate>
				<category><![CDATA[Tutoriels]]></category>
		<guid isPermaLink="false">https://themespress.ca/?p=7435</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<div class="wpb-content-wrapper"><div class="vc_row wpb_row vc_row-fluid"><div class="wpb_column vc_column_container vc_col-sm-12"><div class="vc_column-inner"><div class="wpb_wrapper">
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>Dans ce tutoriel, nous allons ajouter un onglet pour montrer les forfaits souscriptions MemberPress correspondant au client, et ce dans un onglet du compte client Woocommerce.</p>
<p>Le but c&#8217;est d&#8217;ajouter un onglet dans le compte client Woocommerce.</p>

		</div>
	</div>
<div id="ts-enlighterjs-container-2974323" class="ts-enlighterjs-container-single-enabled  " style="width: 100%;  margin-top: 0px; margin-bottom: 0px;" data-enlighter-doubleclick="true" data-enlighter-windowbutton="true" data-enlighter-windowtext="New Window" data-enlighter-rawbutton="true" data-enlighter-rawtext="RAW Code" data-enlighter-infobutton="false" data-enlighter-infotext="EnlighterJS" data-enlighter-indent="2"><pre id="ts-enlighterjs-pre-2974323" class="" style="white-space: pre-wrap; height: 100%; margin: 0; padding: 0;" data-enlighter-language="standard" data-enlighter-theme="enlighter" data-enlighter-group="" data-enlighter-title="" data-enlighter-linenumbers="true" data-enlighter-lineoffset="1" data-enlighter-highlight="">//New Tab Woocommerce
add_filter ( &#039;woocommerce_account_menu_items&#039;, &#039;subscriptions_woocommerce_link&#039;, 40 );
function subscriptions_woocommerce_link( $menu_links ){
	$menu_links = array_slice( $menu_links, 0, 5, true )
	+ array( &#039;subscriptions&#039; =&gt; &#039;Adh&eacute;sions Memberpress&#039; )
	+ array_slice( $menu_links, 5, NULL, true );
	return $menu_links;
}

//Register permalink endpoint
add_action( &#039;init&#039;, &#039;subscriptions_woocommerce_link_add_endpoint&#039; );
function subscriptions_woocommerce_link_add_endpoint() {
    add_rewrite_endpoint( &#039;subscriptions&#039;, EP_PAGES );
}

//Content for the new page in My Account, woocommerce_account_{ENDPOINT NAME}_endpoint
add_action( &#039;woocommerce_account_subscriptions_endpoint&#039;, &#039;subscriptions_endpoint_content&#039; );
function subscriptions_endpoint_content() {
	echo &#039;&lt;h2&gt;Adh&eacute;sions&lt;/h2&gt;&#039;;
	echo do_shortcode(&#039;[mepr-account-form]&#039;);
}</pre></div>
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>Une fois votre code ajouté dans votre functions.php, vous devez aller re-sauvegarder les permaliens sans changer les configurations.<strong> Juste en cliquant sur le bouton Mettre à jour..</strong></p>

		</div>
	</div>

	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>Maintenant, nous allons réécrire la vue layout du template de MemberPress.</p>
<p>Pour ça, il faut dans votre thème, ou thème enfant, s&#8217;il est activé, ajouter un dossier <strong>memberpress</strong> dans la racine de votre thème et ajouter le fichier <strong>mpca-manage-account-template.php.</strong></p>
<p>Vous pouvez allez le copier dans le dossier plugin <strong>memberpress-corporate/app/views/mpca-manage-account-template.php</strong></p>

		</div>
	</div>
</div></div></div></div>
</div><p>The post <a href="https://themespress.ca/souscriptions-memberpress-woocommerce/">Souscriptions MemberPress – Compte client Woocommerce</a> first appeared on <a href="https://themespress.ca">Themespress</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://themespress.ca/souscriptions-memberpress-woocommerce/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Requête du nombre de médias WordPress &#8211; Aujourd&#8217;hui</title>
		<link>https://themespress.ca/requete-nombre-medias-wordpress/</link>
					<comments>https://themespress.ca/requete-nombre-medias-wordpress/#respond</comments>
		
		<dc:creator><![CDATA[Themespress]]></dc:creator>
		<pubDate>Sat, 19 Aug 2023 18:36:16 +0000</pubDate>
				<category><![CDATA[Tutoriels]]></category>
		<guid isPermaLink="false">https://themespress.ca/?p=7333</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<div class="wpb-content-wrapper"><div class="vc_row wpb_row vc_row-fluid"><div class="wpb_column vc_column_container vc_col-sm-12"><div class="vc_column-inner"><div class="wpb_wrapper"><h2 style="text-align: left" class="vc_custom_heading vc_do_custom_heading" >Requête du nombre de médias images d'aujourd'hui - WordPress</h2>
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>Nous allons dans ce tutoriel faire une requête du nombre de médias qui ont été téléversés aujourd&#8217;hui dans les médias WordPress.</p>
<p>Commençons par le type image. Dans notre requête ci-dessous, nous faisons une SQL permettant d&#8217;aller chercher le nombre de médias qui ont été ajouté aujourd&#8217;hui, et ce de type images. <strong>Le post mime type</strong></p>
<p>.<strong>Voici donc la requête SQL dans un shortcode.</strong></p>

		</div>
	</div>
<div id="ts-enlighterjs-container-3329457" class="ts-enlighterjs-container-single-enabled  " style="width: 100%;  margin-top: 0px; margin-bottom: 0px;" data-enlighter-doubleclick="true" data-enlighter-windowbutton="true" data-enlighter-windowtext="New Window" data-enlighter-rawbutton="true" data-enlighter-rawtext="RAW Code" data-enlighter-infobutton="false" data-enlighter-infotext="EnlighterJS" data-enlighter-indent="2"><pre id="ts-enlighterjs-pre-3329457" class="" style="white-space: pre-wrap; height: 100%; margin: 0; padding: 0;" data-enlighter-language="php" data-enlighter-theme="enlighter" data-enlighter-group="" data-enlighter-title="" data-enlighter-linenumbers="true" data-enlighter-lineoffset="1" data-enlighter-highlight="">/**************************** Count des images telechargees aujourd&#039;hui ********************************/

function count_attachments_today() {
    global $wpdb;

    $today = getdate();
    $year = $today[&#039;year&#039;];
    $month = $today[&#039;mon&#039;];
    $day = $today[&#039;mday&#039;];

    $count = $wpdb-&gt;get_var(
        $wpdb-&gt;prepare(
            &quot;SELECT COUNT(ID) FROM $wpdb-&gt;posts
            WHERE post_type = &#039;attachment&#039;
            AND post_mime_type LIKE &#039;image%%&#039;
            AND YEAR(post_date) = %d
            AND MONTH(post_date) = %d
            AND DAY(post_date) = %d&quot;,
            $year, $month, $day
        )
    );

    return &#039;&lt;div class=&quot;addo40px addocenter&quot;&gt;&#039; . $count . &#039;&lt;/div&gt;&#039;;
}
add_shortcode( &#039;attachmentcounttoday&#039;, &#039;count_attachments_today&#039; );</pre></div><h2 style="text-align: left" class="vc_custom_heading vc_do_custom_heading" >Requête du nombre de médias vidéos d'aujourd'hui - WordPress</h2>
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>Nous allons faire la même requête, en questionnant maintenant les médias vidéo. <strong>Voici donc la requête SQL dans un shortcode.</strong></p>

		</div>
	</div>
<div id="ts-enlighterjs-container-1597941" class="ts-enlighterjs-container-single-enabled  " style="width: 100%;  margin-top: 0px; margin-bottom: 0px;" data-enlighter-doubleclick="true" data-enlighter-windowbutton="true" data-enlighter-windowtext="New Window" data-enlighter-rawbutton="true" data-enlighter-rawtext="RAW Code" data-enlighter-infobutton="false" data-enlighter-infotext="EnlighterJS" data-enlighter-indent="2"><pre id="ts-enlighterjs-pre-1597941" class="" style="white-space: pre-wrap; height: 100%; margin: 0; padding: 0;" data-enlighter-language="php" data-enlighter-theme="enlighter" data-enlighter-group="" data-enlighter-title="" data-enlighter-linenumbers="true" data-enlighter-lineoffset="1" data-enlighter-highlight="">/**************************** Count des videos telechargees aujourd&#039;hui ********************************/

function count_videos_attachments_today() {
    global $wpdb;

    $today = getdate();
    $year = $today[&#039;year&#039;];
    $month = $today[&#039;mon&#039;];
    $day = $today[&#039;mday&#039;];

    $count = $wpdb-&gt;get_var(
        $wpdb-&gt;prepare(
            &quot;SELECT COUNT(ID) FROM $wpdb-&gt;posts
            WHERE post_type = &#039;attachment&#039;
            AND post_mime_type LIKE &#039;video%%&#039;
            AND YEAR(post_date) = %d
            AND MONTH(post_date) = %d
            AND DAY(post_date) = %d&quot;,
            $year, $month, $day
        )
    );

    return &#039;&lt;div class=&quot;addo40px addocenter&quot;&gt;&#039; . $count . &#039;&lt;/div&gt;&#039;;
}
add_shortcode( &#039;videoattachmentcounttoday&#039;, &#039;count_videos_attachments_today&#039; );
</pre></div></div></div></div></div>
</div><p>The post <a href="https://themespress.ca/requete-nombre-medias-wordpress/">Requête du nombre de médias WordPress – Aujourd’hui</a> first appeared on <a href="https://themespress.ca">Themespress</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://themespress.ca/requete-nombre-medias-wordpress/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Class PHP &#8211; API You Tube &#8211; Version 3</title>
		<link>https://themespress.ca/class-php-api-you-tube/</link>
					<comments>https://themespress.ca/class-php-api-you-tube/#respond</comments>
		
		<dc:creator><![CDATA[Themespress]]></dc:creator>
		<pubDate>Tue, 04 Jul 2023 14:19:47 +0000</pubDate>
				<category><![CDATA[Tutoriels]]></category>
		<guid isPermaLink="false">https://themespress.ca/?p=7135</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<div class="wpb-content-wrapper"><div class="vc_row wpb_row vc_row-fluid"><div class="wpb_column vc_column_container vc_col-sm-12"><div class="vc_column-inner"><div class="wpb_wrapper">
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>Nous avons créé une PHP Class basique qui permet de se connecter avec L&#8217;API You Tube, et d&#8217;aller afficher une vidéo ou chaîne selon son ID et afficher ses données correspondantes.</p>
<h3>Voici les données incluses de la vidéo.</h3>
<p>Titre<br />
Description<br />
Thumbnail<br />
Views<br />
Likes<br />
Dislikes<br />
Comments<br />
Published At<br />
Channel Title<br />
Tags<br />
Default Language</p>

		</div>
	</div>
<h2 style="text-align: left" class="vc_custom_heading vc_do_custom_heading" >Class PHP - API You Tube</h2><div id="ts-enlighterjs-container-6355933" class="ts-enlighterjs-container-single-enabled  " style="width: 100%;  margin-top: 0px; margin-bottom: 0px;" data-enlighter-doubleclick="true" data-enlighter-windowbutton="true" data-enlighter-windowtext="New Window" data-enlighter-rawbutton="true" data-enlighter-rawtext="RAW Code" data-enlighter-infobutton="false" data-enlighter-infotext="EnlighterJS" data-enlighter-indent="2"><pre id="ts-enlighterjs-pre-6355933" class="" style="white-space: pre-wrap; height: 100%; margin: 0; padding: 0;" data-enlighter-language="standard" data-enlighter-theme="enlighter" data-enlighter-group="" data-enlighter-title="" data-enlighter-linenumbers="true" data-enlighter-lineoffset="1" data-enlighter-highlight="">/////////////////////////// Requires and includes admin theme  /////////////////////////

class WPVYouTubeAPI {
    private $apiKey;

    public function __construct($apiKey)
    {
       $this-&gt;apiKey = $apiKey;
    }

    /**
     * Retrieves videos by channel ID.
     * @param string $channelId The ID of the channel.
     * @param int $maxResults The maximum number of videos to retrieve.
     * @return array An array containing the channel name and videos.
     */
    public function wpvgetVideosByChannel($channelId, $maxResults = 10) {
        $url = &quot;https://www.googleapis.com/youtube/v3/search?part=snippet&amp;channelId={$channelId}&amp;maxResults={$maxResults}&amp;key={$this-&gt;apiKey}&quot;;
        $response = $this-&gt;wpvsendRequest($url);
        $videos = array();
        foreach ($response[&#039;items&#039;] as $item) {
            $videoId = $item[&#039;id&#039;][&#039;videoId&#039;];
            $video = $this-&gt;getVideoDetails($videoId);
            $videos[] = $video;
        }
        // Retrieve the channel name from the first item in the response
        $channelName = $response[&#039;items&#039;][0][&#039;snippet&#039;][&#039;channelTitle&#039;];
        return array(
            &#039;channelName&#039; =&gt; $channelName,
            &#039;videos&#039; =&gt; $videos
        );
    }
    
    /**
     * Retrieves video details by video ID.
     * @param string $videoId The ID of the video.
     * @return array An array containing the video details.
     */
    public function wpvgetVideoDetails($videoId)
    {
        $url = &quot;https://www.googleapis.com/youtube/v3/videos?part=snippet,statistics&amp;id={$videoId}&amp;key={$this-&gt;apiKey}&quot;;

        $response = $this-&gt;wpvsendRequest($url);

        $video = array(
            &#039;title&#039; =&gt; $response[&#039;items&#039;][0][&#039;snippet&#039;][&#039;title&#039;],
            &#039;description&#039; =&gt; $response[&#039;items&#039;][0][&#039;snippet&#039;][&#039;description&#039;],
            &#039;thumbnail&#039; =&gt; $response[&#039;items&#039;][0][&#039;snippet&#039;][&#039;thumbnails&#039;][&#039;default&#039;][&#039;url&#039;],
            &#039;views&#039; =&gt; $response[&#039;items&#039;][0][&#039;statistics&#039;][&#039;viewCount&#039;],
            &#039;likes&#039; =&gt; $response[&#039;items&#039;][0][&#039;statistics&#039;][&#039;likeCount&#039;],
            &#039;dislikes&#039; =&gt; $response[&#039;items&#039;][0][&#039;statistics&#039;][&#039;dislikeCount&#039;],
            &#039;comments&#039; =&gt; $response[&#039;items&#039;][0][&#039;statistics&#039;][&#039;commentCount&#039;],
            &#039;publishedAt&#039; =&gt; $response[&#039;items&#039;][0][&#039;snippet&#039;][&#039;publishedAt&#039;],
            &#039;duration&#039; =&gt; $response[&#039;items&#039;][0][&#039;contentDetails&#039;][&#039;duration&#039;],
            &#039;channelTitle&#039; =&gt; $response[&#039;items&#039;][0][&#039;snippet&#039;][&#039;channelTitle&#039;],
            &#039;tags&#039; =&gt; $response[&#039;items&#039;][0][&#039;snippet&#039;][&#039;tags&#039;],
            &#039;categoryId&#039; =&gt; $response[&#039;items&#039;][0][&#039;snippet&#039;][&#039;categoryId&#039;],
            &#039;defaultLanguage&#039; =&gt; $response[&#039;items&#039;][0][&#039;snippet&#039;][&#039;defaultLanguage&#039;],
            &#039;liveBroadcastContent&#039; =&gt; $response[&#039;items&#039;][0][&#039;snippet&#039;][&#039;liveBroadcastContent&#039;],
            &#039;license&#039; =&gt; $response[&#039;items&#039;][0][&#039;status&#039;][&#039;license&#039;],
            &#039;embedHtml&#039; =&gt; $response[&#039;items&#039;][0][&#039;player&#039;][&#039;embedHtml&#039;],
            &#039;allowedRegions&#039; =&gt; $response[&#039;items&#039;][0][&#039;contentDetails&#039;][&#039;regionRestriction&#039;][&#039;allowed&#039;],
            &#039;blockedRegions&#039; =&gt; $response[&#039;items&#039;][0][&#039;contentDetails&#039;][&#039;regionRestriction&#039;][&#039;blocked&#039;],
            // Add any other data you want to retrieve
        );

        return $video;
    }

    /**
     * Sends a request to the specified URL using cURL.
     * @param string $url The URL to send the request to.
     * @return array The JSON response as an associative array.
     * @throws Exception If cURL encounters an error.
     */
    private function wpvsendRequest($url)
    {
        $curl = curl_init();

        curl_setopt_array($curl, array(
            CURLOPT_URL =&gt; $url,
            CURLOPT_RETURNTRANSFER =&gt; true,
            CURLOPT_FOLLOWLOCATION =&gt; true,
            CURLOPT_ENCODING =&gt; &quot;&quot;,
            CURLOPT_TIMEOUT =&gt; 30,
            CURLOPT_HTTP_VERSION =&gt; CURL_HTTP_VERSION_1_1,
            CURLOPT_CUSTOMREQUEST =&gt; &quot;GET&quot;,
        ));

        $response = curl_exec($curl);
        $err = curl_error($curl);

        curl_close($curl);

        if ($err) {
            throw new Exception(&quot;cURL Error #:&quot; . $err);
        }
        return json_decode($response, true);
    }
    
    /**
     * Retrieves the comments of a video by its video ID.
     * @param string $videoId The ID of the video.
     * @return array An array containing the video comments.
     */
    public function wpvgetVideoComments($videoId) {
        $url = &#039;https://www.googleapis.com/youtube/v3/commentThreads?videoId=&#039; . $videoId . &#039;&amp;part=snippet&amp;maxResults=10&amp;key=&#039; . $this-&gt;apiKey;
        $response = $this-&gt;wpvsendRequest($url);
        
        $comments = array();
        
        if (isset($response[&#039;items&#039;])) {
            foreach ($response[&#039;items&#039;] as $item) {
                $comment = $item[&#039;snippet&#039;][&#039;topLevelComment&#039;][&#039;snippet&#039;][&#039;textDisplay&#039;];
                $comments[] = $comment;
            }
        }
        
        return $comments;
    }
    
    /**
     * Retrieves the channel ID from a video by its video ID.
     * @param string $videoId The ID of the video.
     * @return string|null The channel ID, or null if not found.
     */
    public function wpvgetChannelIdFromVideo($videoId){
        $url = &quot;https://www.googleapis.com/youtube/v3/videos?part=snippet&amp;id={$videoId}&amp;key={$this-&gt;apiKey}&quot;;
        $response = $this-&gt;wpvsendRequest($url);
        if (!empty($response[&#039;items&#039;])) {
            $channelId = $response[&#039;items&#039;][0][&#039;snippet&#039;][&#039;channelId&#039;];
            return $channelId;
        }
        return null;
    }
    
    /**
     * Formats the number of views to a human-readable format.
     * @param int $views The number of views.
     * @return string The formatted views.
     */
    public function wpvformatViews($views) {
        if ($views &gt;= 1000000000) {
            return round($views / 1000000000, 1) . &#039; billion&#039;;
        } elseif ($views &gt;= 1000000) {
            return round($views / 1000000, 1) . &#039; million&#039;;
        } elseif ($views &gt;= 1000) {
            return round($views / 1000, 1) . &#039; thousand&#039;;
        } else {
            return $views;
        }
    }
   
}</pre></div>
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>Nous allons faire un appel à la PHP Class et afficher nos données correspondantes. Il faut mettre à jour <strong>votre clé API dans la variable $apiKey </strong>et ensuite appeller dynamiquement<strong> l&#8217;ID de votre vidéo dans la variable $videoId.</strong></p>

		</div>
	</div>
<div id="ts-enlighterjs-container-5821474" class="ts-enlighterjs-container-single-enabled  " style="width: 100%;  margin-top: 0px; margin-bottom: 0px;" data-enlighter-doubleclick="true" data-enlighter-windowbutton="true" data-enlighter-windowtext="New Window" data-enlighter-rawbutton="true" data-enlighter-rawtext="RAW Code" data-enlighter-infobutton="false" data-enlighter-infotext="EnlighterJS" data-enlighter-indent="2"><pre id="ts-enlighterjs-pre-5821474" class="" style="white-space: pre-wrap; height: 100%; margin: 0; padding: 0;" data-enlighter-language="standard" data-enlighter-theme="enlighter" data-enlighter-group="" data-enlighter-title="" data-enlighter-linenumbers="true" data-enlighter-lineoffset="1" data-enlighter-highlight="">// API Call Class PHP
$apiKey = &#039;YOUR API KEY HERE&#039;;
$youtube = new WPVYouTubeAPI($apiKey);
$videoId = &#039;YOUR VIDEO ID HERE&#039;;

// Get video details
$videoDetails = $youtube-&gt;wpvgetVideoDetails($videoId);
$channelId = $youtube-&gt;wpvgetChannelIdFromVideo($videoId);
$publishedDate = date(&#039;Y-m-d&#039;, strtotime($videoDetails[&#039;publishedAt&#039;]));

// Echo the title of the video
echo &#039;Titre : &#039; . $videoDetails[&#039;title&#039;] . &#039;&lt;br&gt;&#039;;

//echo &#039;Description : &#039; . $videoDetails[&#039;description&#039;] . &#039;&lt;br&gt;&#039;;
echo &#039;&lt;img src=&quot;&#039; . $videoDetails[&#039;thumbnail&#039;] . &#039;&quot; alt=&quot;Thumbnail de la vid&eacute;o&quot;&gt;&lt;br&gt;&#039;;

// Display the formatted duration
//echo &#039;Dur&eacute;e : &#039; . $formattedDuration . &#039;&lt;br&gt;&#039;;

// Echo the channel title
echo &#039;Channel : &#039; . $videoDetails[&#039;channelTitle&#039;] . &#039;&lt;br&gt;&#039;;

// Echo the published date of the video
echo &#039;Publi&eacute; le : &#039; . $publishedDate . &#039;&lt;br&gt;&#039;;

// Check if default language is available
if (!empty($videoDetails[&#039;defaultLanguage&#039;])) {
    echo &#039;Language : &#039; . $videoDetails[&#039;defaultLanguage&#039;] . &#039;&lt;br&gt;&#039;;
} else {
    echo &#039;Language : Undefined&lt;br&gt;&#039;;
}

// Display license
if (!empty($videoDetails[&#039;license&#039;])) {
    echo &#039;License : &#039; . $videoDetails[&#039;license&#039;] . &#039;&lt;br&gt;&#039;;
} else {
    echo &#039;License : Not specified&lt;br&gt;&#039;;
}

// Display the Channel Name of the video 
if (!empty($videoDetails[&#039;channelId&#039;])) {
    $maxResults = 10; // Maximum number of videos to retrieve
    $videosData = $youtube-&gt;wpvgetVideosByChannel($channelId, $maxResults);
    $channelName = $videosData[&#039;channelName&#039;];
    $videos = $videosData[&#039;videos&#039;];
    echo &quot;Channel Name: $channelName&lt;br&gt;&quot;;
} else {
    echo &quot;No channel found for the video.&lt;br&gt;&quot;;
}

// Display the tags
if (isset($videoDetails[&#039;tags&#039;])) {
    if (is_array($videoDetails[&#039;tags&#039;])) {
        $formattedTags = array_map(&#039;ucfirst&#039;, $videoDetails[&#039;tags&#039;]); // Apply ucfirst to each tag
        $tags = implode(&#039;, &#039;, $formattedTags);
        echo &#039;Tags: &#039; . $tags . &#039;&lt;br&gt;&#039;;
    } else {
        $tags = ucfirst($videoDetails[&#039;tags&#039;]); // Capitalize the first letter
        echo &#039;Mots-cl&eacute;s : &#039; . $tags . &#039;&lt;br&gt;&#039;;
    }
} else {
    echo &#039;Mots-cl&eacute;s : None&lt;br&gt;&#039;;
}

// Display the Views of the video 
echo &#039;Vues : &#039; . $youtube-&gt;wpvformatViews($videoDetails[&#039;views&#039;]) . &#039;&lt;br&gt;&#039;;

// Display the Likes of the video 
echo &#039;Passion&eacute;(e)s : &#039; . $videoDetails[&#039;likes&#039;] . &#039;&lt;br&gt;&#039;;

// Display the Dislikes of the video 
$dislikes = $videoDetails[&#039;dislikes&#039;];
if ($dislikes &gt; 0) {
    echo &#039;Dislikes : &#039; . $dislikes . &#039;&lt;br&gt;&#039;;
} else {
    echo &#039;Dislikes : 0&lt;br&gt;&#039;;
}

// Display the Favorites of the video 
$favorites = $videoDetails[&#039;favorites&#039;];
if ($favorites &gt; 0) {
    echo &#039;Favorites : &#039; . $favorites . &#039;&lt;br&gt;&#039;;
} else {
    echo &#039;Favorites : 0&lt;br&gt;&#039;;
}

// Display the Comments of the video 
echo &#039;Comments : &#039; . $videoDetails[&#039;comments&#039;] . &#039;&lt;br&gt;&#039;;</pre></div>
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>Vous pouvez aussi inclure des icônes <strong><a href="https://fontawesome.com/v5/search">Font Awesome Version 5</a></strong> en faisant un <a href="https://gist.github.com/danielmcclure/d1b8e492bedcced7c8016ed37f197623"><strong>enqueue script</strong></a> de cette façon-ci, <strong>ou de l&#8217;ajouter dans la Class PHP <span class="">WPVYouTubeAPI.</span></strong></p>

		</div>
	</div>
<div id="ts-enlighterjs-container-2611046" class="ts-enlighterjs-container-single-enabled  " style="width: 100%;  margin-top: 0px; margin-bottom: 0px;" data-enlighter-doubleclick="true" data-enlighter-windowbutton="true" data-enlighter-windowtext="New Window" data-enlighter-rawbutton="true" data-enlighter-rawtext="RAW Code" data-enlighter-infobutton="false" data-enlighter-infotext="EnlighterJS" data-enlighter-indent="2"><pre id="ts-enlighterjs-pre-2611046" class="" style="white-space: pre-wrap; height: 100%; margin: 0; padding: 0;" data-enlighter-language="standard" data-enlighter-theme="enlighter" data-enlighter-group="" data-enlighter-title="" data-enlighter-linenumbers="true" data-enlighter-lineoffset="1" data-enlighter-highlight="">// Enqueue Font Awesome 5 in WordPress 
function themespress_load_font_awesome() {
    // You can find the current URL for the latest version here: https://fontawesome.com/start
    wp_enqueue_style( &#039;font-awesome-free&#039;, &#039;//use.fontawesome.com/releases/v5.6.3/css/all.css&#039; );
}
add_action( &#039;wp_enqueue_scripts&#039;, &#039;themespress_load_font_awesome&#039; );</pre></div></div></div></div></div>
</div><p>The post <a href="https://themespress.ca/class-php-api-you-tube/">Class PHP – API You Tube – Version 3</a> first appeared on <a href="https://themespress.ca">Themespress</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://themespress.ca/class-php-api-you-tube/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Créer un shortcode des articles modifiés</title>
		<link>https://themespress.ca/shortcode-articles-modifies/</link>
					<comments>https://themespress.ca/shortcode-articles-modifies/#respond</comments>
		
		<dc:creator><![CDATA[Themespress]]></dc:creator>
		<pubDate>Sat, 04 Mar 2023 20:38:57 +0000</pubDate>
				<category><![CDATA[Tutoriels]]></category>
		<guid isPermaLink="false">https://themespress.ca/?p=6959</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<div class="wpb-content-wrapper"><div class="vc_row wpb_row vc_row-fluid"><div class="wpb_column vc_column_container vc_col-sm-12"><div class="vc_column-inner"><div class="wpb_wrapper">
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>Dans ce tutoriel, nous allons créér un shortode permettant d&#8217;afficher les derniers articles ou type d&#8217;article.</p>
<p>Dans notre exemple, nous allons afficher les articles modifiés il y a moins de 15 jours.</p>
<p>Cependant, nous allons <strong>avant tout afficher les derniers articles publiés</strong> il y a <strong>moins de quinze jours</strong>. Ensuite, nous peaufinerons <strong>notre requête pour les articles modifiés</strong>.</p>

		</div>
	</div>
<h2 style="text-align: left" class="vc_custom_heading vc_do_custom_heading" >Afficher les derniers articles publiés - de 15 jours</h2><div id="ts-enlighterjs-container-4060980" class="ts-enlighterjs-container-single-enabled  " style="width: 100%;  margin-top: 0px; margin-bottom: 0px;" data-enlighter-doubleclick="true" data-enlighter-windowbutton="true" data-enlighter-windowtext="New Window" data-enlighter-rawbutton="true" data-enlighter-rawtext="RAW Code" data-enlighter-infobutton="false" data-enlighter-infotext="EnlighterJS" data-enlighter-indent="2"><pre id="ts-enlighterjs-pre-4060980" class="" style="white-space: pre-wrap; height: 100%; margin: 0; padding: 0;" data-enlighter-language="php" data-enlighter-theme="enlighter" data-enlighter-group="" data-enlighter-title="" data-enlighter-linenumbers="true" data-enlighter-lineoffset="1" data-enlighter-highlight="">/**************************** Last Posts 15 days ********************************/
add_shortcode( &#039;lastaddoposts&#039;, &#039;addo_list_posts_publied&#039; );
function addo_list_posts_publied(){ 
	$date_range = strtotime ( &#039;-15 day&#039; );
	// Custom WP query query
	$args = array(
		&#039;post_type&#039;         =&gt; array(&#039;post&#039;),
		&#039;post_status&#039;       =&gt; &#039;publish&#039;,
		&#039;order&#039;             =&gt; &#039;DESC&#039;, 
		&#039;date_query&#039;        =&gt; array(
			array(
				&#039;after&#039; =&gt; array(
					&#039;year&#039;  =&gt; date(&#039;Y&#039;, $date_range ),
					&#039;month&#039; =&gt; date(&#039;m&#039;, $date_range ),
					&#039;day&#039;   =&gt; date(&#039;d&#039;, $date_range ),
				),
			)
		)
	);
	$query = new WP_Query( $args );

    echo &#039;&lt;ul style=&quot;padding:0&quot;&gt;&#039;;
		if ( $query-&gt;have_posts() ) {
			while ( $query-&gt;have_posts() ) { 
			$query-&gt;the_post();
			echo &#039;&lt;div class=&quot;col-md-3&quot; style=&quot;display:inline-block;&quot;&gt;&#039;;
				echo &#039;&lt;li style=&quot;position:relative&quot;&gt;&#039;;	
					echo &#039;&lt;a style=&quot;display:block;background-color: #490b3d;padding: 10px 25px;color: white;&quot; href=&quot;&#039; . get_the_permalink() . &#039;&quot;&gt;&#039;;
					echo the_title();
					echo&#039;&lt;/a&gt;&#039;;
					echo &#039;&lt;span style=&quot;padding:0px 5px;background:#f1b814;color:white;position:absolute;top:-10px;right:0;font-size:11px&quot;&gt;&#039; . get_the_time(&#039;d-m-Y&#039;) . &#039;&lt;/span&gt;&#039;;
				echo &#039;&lt;/li&gt;&#039;;
			echo &#039;&lt;/div&gt;&#039;;
			}
		}
	else {
		echo &#039;Il n&amp;#39;y a eu aucune publication ces derni&egrave;res semaines&#039;;
	}
	wp_reset_postdata();
    echo &#039;&lt;/ul&gt;&#039;;		
}</pre></div><h2 style="text-align: left" class="vc_custom_heading vc_do_custom_heading" >Shortcode dans les pages</h2><div id="ts-enlighterjs-container-1658830" class="ts-enlighterjs-container-single-enabled  " style="width: 100%;  margin-top: 0px; margin-bottom: 0px;" data-enlighter-doubleclick="true" data-enlighter-windowbutton="true" data-enlighter-windowtext="New Window" data-enlighter-rawbutton="true" data-enlighter-rawtext="RAW Code" data-enlighter-infobutton="false" data-enlighter-infotext="EnlighterJS" data-enlighter-indent="2"><pre id="ts-enlighterjs-pre-1658830" class="ts-enlighterjs-pre-nohighlight" style="" data-enlighter-language="no-highlight" data-enlighter-theme="enlighter" data-enlighter-group="" data-enlighter-title="" data-enlighter-linenumbers="true" data-enlighter-lineoffset="1" data-enlighter-highlight="">[lastaddoposts]</pre></div><h2 style="text-align: left" class="vc_custom_heading vc_do_custom_heading" >Shortcode dans les templates</h2><div id="ts-enlighterjs-container-9141994" class="ts-enlighterjs-container-single-enabled  " style="width: 100%;  margin-top: 0px; margin-bottom: 0px;" data-enlighter-doubleclick="true" data-enlighter-windowbutton="true" data-enlighter-windowtext="New Window" data-enlighter-rawbutton="true" data-enlighter-rawtext="RAW Code" data-enlighter-infobutton="false" data-enlighter-infotext="EnlighterJS" data-enlighter-indent="2"><pre id="ts-enlighterjs-pre-9141994" class="ts-enlighterjs-pre-nohighlight" style="" data-enlighter-language="no-highlight" data-enlighter-theme="enlighter" data-enlighter-group="" data-enlighter-title="" data-enlighter-linenumbers="true" data-enlighter-lineoffset="1" data-enlighter-highlight="">&lt;?php echo do_shortcode( &#039;[lastaddoposts]&#039; ); ?&gt;</pre></div>
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>Nous allons maintenant corriger notre requête et afficher <strong>les derniers articles modifiées</strong> il y a moins de <strong>quinze jours</strong>.</p>

		</div>
	</div>
<h2 style="text-align: left" class="vc_custom_heading vc_do_custom_heading" >Afficher les derniers articles modifiés - de 15 jours</h2><div id="ts-enlighterjs-container-9442158" class="ts-enlighterjs-container-single-enabled  " style="width: 100%;  margin-top: 0px; margin-bottom: 0px;" data-enlighter-doubleclick="true" data-enlighter-windowbutton="true" data-enlighter-windowtext="New Window" data-enlighter-rawbutton="true" data-enlighter-rawtext="RAW Code" data-enlighter-infobutton="false" data-enlighter-infotext="EnlighterJS" data-enlighter-indent="2"><pre id="ts-enlighterjs-pre-9442158" class="" style="white-space: pre-wrap; height: 100%; margin: 0; padding: 0;" data-enlighter-language="php" data-enlighter-theme="enlighter" data-enlighter-group="" data-enlighter-title="" data-enlighter-linenumbers="true" data-enlighter-lineoffset="1" data-enlighter-highlight="">/**************************** Last Posts modified 15 days ********************************/
add_shortcode( &#039;postsaddomodified&#039;, &#039;addo_list_posts_modified&#039; );
function addo_list_posts_modified() {
	// query args
    $args = array(
		&#039;posts_per_page&#039;        =&gt; &#039;10&#039;,
		&#039;post_type&#039;             =&gt; &#039;post&#039;,
		&#039;post_status&#039;           =&gt; &#039;publish&#039;,
		&#039;orderby&#039;               =&gt; &#039;modified&#039;,
		&#039;order&#039;                 =&gt; &#039;DESC&#039;,
		&#039;ignore_sticky_posts&#039;   =&gt; &#039;1&#039;,
		&#039;caller_get_posts&#039;      =&gt; 1,
		&#039;date_query&#039; =&gt; array(
        &#039;relation&#039;   =&gt; &#039;OR&#039;,
        array(
            &#039;column&#039;  =&gt; &#039;post_date&#039;,
            &#039;after&#039;   =&gt; &#039;-1 days&#039;
        ),
        array(
            &#039;column&#039;  =&gt; &#039;post_modified&#039;,
            &#039;after&#039;   =&gt; &#039;-15 days&#039;
        )
    )
    );

    // query
    $updated = new WP_Query($args);

?&gt;
&lt;ul style=&quot;padding:0&quot;&gt;
	&lt;?php if ( $updated-&gt;have_posts() ) : ?&gt;
	&lt;?php while ( $updated-&gt;have_posts() ) : $updated-&gt;the_post(); ?&gt;
	&lt;div class=&quot;col-md-3&quot; style=&quot;display:inline-block;padding:0px&quot;&gt;
		&lt;li style=&quot;position:relative&quot;&gt;	
			&lt;a style=&quot;display:block;background-color: #490b3d;padding: 10px 25px;color: white;margin:0 0 10px 0&quot; href=&quot;https://famillebreboin.ca/photos/&quot;&gt;
			   &lt;?php the_title(); ?&gt;
			&lt;/a&gt;
			&lt;span style=&quot;padding:0px 5px;background:#f1b814;color:white;position:absolute;top:-10px;right:0;font-size:11px&quot;&gt;
			&lt;?php get_the_time(&#039;d-m-Y&#039;); ?&gt;
			&lt;/span&gt;
		&lt;/li&gt;
	&lt;/div&gt;
	&lt;?php endwhile; ?&gt;
	&lt;?php wp_reset_postdata(); ?&gt;
	&lt;?php else : ?&gt;
		&lt;?php echo &#039;Il n&amp;#39;y a eu aucun album mis &agrave; jour&#039;;  ?&gt;
	&lt;?php endif; ?&gt;
&lt;/ul&gt;
&lt;?php }</pre></div><h2 style="text-align: left" class="vc_custom_heading vc_do_custom_heading" >Shortcode dans les pages</h2><div id="ts-enlighterjs-container-8064372" class="ts-enlighterjs-container-single-enabled  " style="width: 100%;  margin-top: 0px; margin-bottom: 0px;" data-enlighter-doubleclick="true" data-enlighter-windowbutton="true" data-enlighter-windowtext="New Window" data-enlighter-rawbutton="true" data-enlighter-rawtext="RAW Code" data-enlighter-infobutton="false" data-enlighter-infotext="EnlighterJS" data-enlighter-indent="2"><pre id="ts-enlighterjs-pre-8064372" class="ts-enlighterjs-pre-nohighlight" style="" data-enlighter-language="no-highlight" data-enlighter-theme="enlighter" data-enlighter-group="" data-enlighter-title="" data-enlighter-linenumbers="true" data-enlighter-lineoffset="1" data-enlighter-highlight="">[postsaddomodified]</pre></div><h2 style="text-align: left" class="vc_custom_heading vc_do_custom_heading" >Shortcode dans les templates</h2><div id="ts-enlighterjs-container-3860000" class="ts-enlighterjs-container-single-enabled  " style="width: 100%;  margin-top: 0px; margin-bottom: 0px;" data-enlighter-doubleclick="true" data-enlighter-windowbutton="true" data-enlighter-windowtext="New Window" data-enlighter-rawbutton="true" data-enlighter-rawtext="RAW Code" data-enlighter-infobutton="false" data-enlighter-infotext="EnlighterJS" data-enlighter-indent="2"><pre id="ts-enlighterjs-pre-3860000" class="ts-enlighterjs-pre-nohighlight" style="" data-enlighter-language="no-highlight" data-enlighter-theme="enlighter" data-enlighter-group="" data-enlighter-title="" data-enlighter-linenumbers="true" data-enlighter-lineoffset="1" data-enlighter-highlight="">&lt;?php echo do_shortcode( &#039;[postsaddomodified]&#039; ); ?&gt;</pre></div></div></div></div></div>
</div><p>The post <a href="https://themespress.ca/shortcode-articles-modifies/">Créer un shortcode des articles modifiés</a> first appeared on <a href="https://themespress.ca">Themespress</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://themespress.ca/shortcode-articles-modifies/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Redirection des pages 404</title>
		<link>https://themespress.ca/redirection-pages-404/</link>
					<comments>https://themespress.ca/redirection-pages-404/#respond</comments>
		
		<dc:creator><![CDATA[Themespress]]></dc:creator>
		<pubDate>Thu, 22 Dec 2022 15:21:13 +0000</pubDate>
				<category><![CDATA[Tutoriels]]></category>
		<guid isPermaLink="false">https://themespress.ca/?p=6895</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<div class="wpb-content-wrapper"><div class="vc_row wpb_row vc_row-fluid"><div class="wpb_column vc_column_container vc_col-sm-12"><div class="vc_column-inner"><div class="wpb_wrapper">
	<div class="wpb_text_column wpb_content_element vc_custom_1671721681346" >
		<div class="wpb_wrapper">
			<p><strong>Redirection des pages 404 :</strong> Il y a bien des raisons de vouloir créer une redirection des pages 404. Nous allons dans ce tutoriel, faire cette redirection vers la page d&#8217;accueil.</p>
<p>Nous allons pour ça utiliser le hook <a href="https://developer.wordpress.org/reference/hooks/template_redirect/" target="_blank" rel="noopener"><strong>Template Redirect</strong></a></p>

		</div>
	</div>
</div></div></div></div><div class="vc_row wpb_row vc_row-fluid"><div class="wpb_column vc_column_container vc_col-sm-12"><div class="vc_column-inner"><div class="wpb_wrapper"><h2 style="text-align: left" class="vc_custom_heading vc_do_custom_heading vc_custom_1671721735184" >Redirection des pages 404</h2></div></div></div></div><div class="vc_row wpb_row vc_row-fluid"><div class="wpb_column vc_column_container vc_col-sm-12"><div class="vc_column-inner"><div class="wpb_wrapper"><div id="ts-enlighterjs-container-1599710" class="ts-enlighterjs-container-single-enabled  " style="width: 100%;  margin-top: 0px; margin-bottom: 0px;" data-enlighter-doubleclick="true" data-enlighter-windowbutton="true" data-enlighter-windowtext="New Window" data-enlighter-rawbutton="true" data-enlighter-rawtext="RAW Code" data-enlighter-infobutton="false" data-enlighter-infotext="EnlighterJS" data-enlighter-indent="2"><pre id="ts-enlighterjs-pre-1599710" class="" style="white-space: pre-wrap; height: 100%; margin: 0; padding: 0;" data-enlighter-language="php" data-enlighter-theme="enlighter" data-enlighter-group="" data-enlighter-title="" data-enlighter-linenumbers="true" data-enlighter-lineoffset="1" data-enlighter-highlight="">add_action(&#039;template_redirect&#039;, &#039;themespress_redirect_404_to_homepage&#039;, 999);
function themespress_redirect_404_to_homepage(){
    if(!is_404())
    return;
    wp_redirect(home_url());
    exit;
}</pre></div>
	<div class="wpb_text_column wpb_content_element vc_custom_1671722090656" >
		<div class="wpb_wrapper">
			<p>Pour cette redirection, il faut s&#8217;accorder que toutes les pages 404 soient redirigées, donc dans notre cas, il n&#8217;est pas nécessaire de customiser une page PHP 404.php dans votre thème.</p>

		</div>
	</div>
</div></div></div></div>
</div><p>The post <a href="https://themespress.ca/redirection-pages-404/">Redirection des pages 404</a> first appeared on <a href="https://themespress.ca">Themespress</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://themespress.ca/redirection-pages-404/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Table WordPress &#8211; Entrées d&#8217;un formulaire Formidable</title>
		<link>https://themespress.ca/creer-une-entree-table-venant-dun-formulaire-formidable/</link>
					<comments>https://themespress.ca/creer-une-entree-table-venant-dun-formulaire-formidable/#respond</comments>
		
		<dc:creator><![CDATA[Themespress]]></dc:creator>
		<pubDate>Fri, 21 Oct 2022 13:32:17 +0000</pubDate>
				<category><![CDATA[Tutoriels]]></category>
		<category><![CDATA[Formidable Form]]></category>
		<guid isPermaLink="false">https://themespress.ca/?p=6794</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<div class="wpb-content-wrapper"><div class="vc_row wpb_row vc_row-fluid"><div class="wpb_column vc_column_container vc_col-sm-12"><div class="vc_column-inner"><div class="wpb_wrapper">
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p><strong>Table WordPress</strong> : Vous souhaitez créer une entrée dans une table personnalisée WordPress venant d&#8217;un formulaire Formidable Form ?</p>
<p>Imaginons que vous avez créé une table afin d&#8217;obtenir des données formulaire ou d&#8217;en faire des statistiques.</p>
<p>Ainsi votre table créée avec ses colonnes respectives, <strong>construisez donc les champs correspondants aux colonnes</strong> de votre table.</p>
<p>Si vous souhaitez créer une table avec une fonction, voici une fonction qui permet de <a href="https://deliciousbrains.com/creating-custom-table-php-wordpress/" target="_blank" rel="noopener"><strong>créer une table WordPress (Article interressant)</strong></a></p>

		</div>
	</div>

	<div  class="wpb_single_image wpb_content_element vc_align_left wpb_content_element">
		
		<figure class="wpb_wrapper vc_figure">
			<div class="vc_single_image-wrapper   vc_box_border_grey"><img decoding="async" width="1903" height="955" src="https://themespress.ca/wp-content/uploads/2022/10/Creer-une-entree-table-venant-dun-formulaire-Formidable.png" class="vc_single_image-img attachment-full" alt="Créer une entrée table venant d&#039;un formulaire Formidable" title="Créer une entrée table venant d&#039;un formulaire Formidable" srcset="https://themespress.ca/wp-content/uploads/2022/10/Creer-une-entree-table-venant-dun-formulaire-Formidable.png 1903w, https://themespress.ca/wp-content/uploads/2022/10/Creer-une-entree-table-venant-dun-formulaire-Formidable-600x301.png 600w, https://themespress.ca/wp-content/uploads/2022/10/Creer-une-entree-table-venant-dun-formulaire-Formidable-300x151.png 300w, https://themespress.ca/wp-content/uploads/2022/10/Creer-une-entree-table-venant-dun-formulaire-Formidable-1024x514.png 1024w, https://themespress.ca/wp-content/uploads/2022/10/Creer-une-entree-table-venant-dun-formulaire-Formidable-768x385.png 768w, https://themespress.ca/wp-content/uploads/2022/10/Creer-une-entree-table-venant-dun-formulaire-Formidable-1536x771.png 1536w, https://themespress.ca/wp-content/uploads/2022/10/Creer-une-entree-table-venant-dun-formulaire-Formidable-1320x662.png 1320w" sizes="(max-width: 1903px) 100vw, 1903px" /></div>
		</figure>
	</div>
<div id="ts-enlighterjs-container-1788653" class="ts-enlighterjs-container-single-enabled  " style="width: 100%;  margin-top: 0px; margin-bottom: 0px;" data-enlighter-doubleclick="true" data-enlighter-windowbutton="true" data-enlighter-windowtext="New Window" data-enlighter-rawbutton="true" data-enlighter-rawtext="RAW Code" data-enlighter-infobutton="false" data-enlighter-infotext="EnlighterJS" data-enlighter-indent="2"><pre id="ts-enlighterjs-pre-1788653" class="" style="white-space: pre-wrap; height: 100%; margin: 0; padding: 0;" data-enlighter-language="standard" data-enlighter-theme="enlighter" data-enlighter-group="" data-enlighter-title="" data-enlighter-linenumbers="true" data-enlighter-lineoffset="1" data-enlighter-highlight="">//////////////////////////////////////////////////////////////////////
// Create database table
//////////////////////////////////////////////////////////////////////

function database_wooclassementstats() {
	global $wpdb;
	$charset_collate = $wpdb-&gt;get_charset_collate();
	$table_name = $wpdb-&gt;prefix . &#039;wooclassementstats&#039;;
		$sql = &quot;CREATE TABLE $table_name (
		id mediumint(9) NOT NULL AUTO_INCREMENT,
		viewdate date DEFAULT &#039;0000-00-00&#039; NOT NULL,
		viewtime time DEFAULT &#039;00:00:00&#039; NOT NULL,
		productid int(11) NOT NULL,
		productname varchar(60) NOT NULL,
		producturl text NOT NULL,
		userip varchar(60) NOT NULL,
		username varchar(60) NOT NULL,
		userid bigint(20) NOT NULL,
		usercountry text NOT NULL,
		usercity varchar(255) NOT NULL,
		userbrowser varchar(255) NOT NULL,
		userbrowserversion varchar(255) NOT NULL,
		userbrowserplateform varchar(255) NOT NULL,	
		userviews smallint(5) NOT NULL,
		userclicks smallint(5) NOT NULL,
		urlfrom text NOT NULL,
		type varchar(60) DEFAULT &#039;vue&#039; NOT NULL,
		language varchar(60) NOT NULL,
		UNIQUE KEY id (id)
		) $charset_collate;&quot;;
	require_once( ABSPATH . &#039;wp-admin/includes/upgrade.php&#039; );
	dbDelta( $sql );
}	
add_action( &#039;init&#039;, &#039;database_wooclassementstats&#039;);</pre></div>
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>Donc voici notre table dans <strong>phpMyAdmin.</strong></p>

		</div>
	</div>

	<div  class="wpb_single_image wpb_content_element vc_align_left wpb_content_element">
		
		<figure class="wpb_wrapper vc_figure">
			<div class="vc_single_image-wrapper   vc_box_border_grey"><img decoding="async" width="1917" height="448" src="https://themespress.ca/wp-content/uploads/2022/10/Creation-de-table-dans-phpMyAdmin.png" class="vc_single_image-img attachment-full" alt="" title="Création de table dans phpMyAdmin" srcset="https://themespress.ca/wp-content/uploads/2022/10/Creation-de-table-dans-phpMyAdmin.png 1917w, https://themespress.ca/wp-content/uploads/2022/10/Creation-de-table-dans-phpMyAdmin-600x140.png 600w, https://themespress.ca/wp-content/uploads/2022/10/Creation-de-table-dans-phpMyAdmin-300x70.png 300w, https://themespress.ca/wp-content/uploads/2022/10/Creation-de-table-dans-phpMyAdmin-1024x239.png 1024w, https://themespress.ca/wp-content/uploads/2022/10/Creation-de-table-dans-phpMyAdmin-768x179.png 768w, https://themespress.ca/wp-content/uploads/2022/10/Creation-de-table-dans-phpMyAdmin-1536x359.png 1536w, https://themespress.ca/wp-content/uploads/2022/10/Creation-de-table-dans-phpMyAdmin-1320x308.png 1320w" sizes="(max-width: 1917px) 100vw, 1917px" /></div>
		</figure>
	</div>

	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>Comme vous pouvez le constater, il y a plusieurs colonnes dans notre table WordPress.</p>
<p>Tout d&#8217;abord, changer le nom de la table <strong><span class="st0">wooclassementstats </span></strong><span class="st0">par le nom de <strong>votre table</strong>.</span></p>
<p>Aussi, remplacez les colonnes de la table par les vôtres en changeant leurs noms et en adaptant les types de colonnes recherchées.</p>

		</div>
	</div>
<h2 style="text-align: left" class="vc_custom_heading vc_do_custom_heading vc_custom_1666357967792" >Insérer les données des champs Formidable - Table WordPress</h2>
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>Pour cela, nous allons utiliser le <a href="https://formidableforms.com/knowledgebase/formidable-hooks/" target="_blank" rel="noopener"><strong>hook Formidable Form</strong></a> <a href="https://formidableforms.com/knowledgebase/frm_after_create_entry/" target="_blank" rel="noopener">frm_after_create_entry</a></p>
<p>Dans notre hook, nous allons donner la condition d&#8217;aller chercher les données provenant de notre formulaire correspondant à notre ID formulaire.</p>
<p>La variable <strong><span class="kw3">$values</span></strong> englobe les valeurs récupérées de notre formulaire. Changer <strong>les noms des colonnes</strong> et <strong>les IDS des champs correspondant</strong> à chaque champ.</p>

		</div>
	</div>
<div id="ts-enlighterjs-container-8307947" class="ts-enlighterjs-container-single-enabled  " style="width: 100%;  margin-top: 0px; margin-bottom: 0px;" data-enlighter-doubleclick="true" data-enlighter-windowbutton="true" data-enlighter-windowtext="New Window" data-enlighter-rawbutton="true" data-enlighter-rawtext="RAW Code" data-enlighter-infobutton="false" data-enlighter-infotext="EnlighterJS" data-enlighter-indent="2"><pre id="ts-enlighterjs-pre-8307947" class="" style="white-space: pre-wrap; height: 100%; margin: 0; padding: 0;" data-enlighter-language="php" data-enlighter-theme="enlighter" data-enlighter-group="" data-enlighter-title="" data-enlighter-linenumbers="true" data-enlighter-lineoffset="1" data-enlighter-highlight="">add_action(&#039;frm_after_create_entry&#039;, &#039;copy_into_my_table&#039;, 20, 2);
function copy_into_my_table($entry_id, $form_id){ 
  if($form_id == 2){ //change 4 to the form id of the form to copy
    global $wpdb;
    $values = array(
    &#039;col_name&#039;         =&gt; $_POST[&#039;item_meta&#039;][24], 
    &#039;col_name&#039;         =&gt; $_POST[&#039;item_meta&#039;][25], 
    &#039;col_name&#039;         =&gt; $_POST[&#039;item_meta&#039;][22],
    &#039;col_name&#039;         =&gt; $_POST[&#039;item_meta&#039;][21],
    &#039;col_name&#039;         =&gt; $_POST[&#039;item_meta&#039;][26],
    &#039;col_name&#039;         =&gt; $_POST[&#039;item_meta&#039;][23],
    &#039;col_name&#039;         =&gt; &#039;&#039;,
    &#039;col_name&#039;         =&gt; &#039;&#039;, 
    &#039;col_name&#039;         =&gt; $_POST[&#039;item_meta&#039;][27],
    );
    //replace 25 and 26 with the field ids of the Formidable form. Change col_name to the column names in your table
    $wpdb-&gt;insert(&#039;wpeo_LDAAnalytics&#039;, $values); 
  }
}</pre></div><h2 style="text-align: left" class="vc_custom_heading vc_do_custom_heading vc_custom_1666357768117" >Pour les sites web Multisites</h2>
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>Si vous avez un multisite, dans un premier temps, il faut s&#8217;assurer que les formulaires n&#8217;aient pas le même ID. Si cela arrive, il faut utiliser le <a href="https://developer.wordpress.org/reference/functions/switch_to_blog/" target="_blank" rel="noopener"><strong>switch_to_blog</strong></a></p>
<p>On englobe notre condition formulaire entre les <strong>switch_to_blog</strong> et le <strong>restore_current_blog(); </strong> qui va s’assurer de respecter la requête dans la condition du blog concerné.</p>

		</div>
	</div>
</div></div></div></div><div class="vc_row wpb_row vc_row-fluid"><div class="wpb_column vc_column_container vc_col-sm-12"><div class="vc_column-inner"><div class="wpb_wrapper"><div id="ts-enlighterjs-container-1359384" class="ts-enlighterjs-container-single-enabled  " style="width: 100%;  margin-top: 0px; margin-bottom: 0px;" data-enlighter-doubleclick="true" data-enlighter-windowbutton="true" data-enlighter-windowtext="New Window" data-enlighter-rawbutton="true" data-enlighter-rawtext="RAW Code" data-enlighter-infobutton="false" data-enlighter-infotext="EnlighterJS" data-enlighter-indent="2"><pre id="ts-enlighterjs-pre-1359384" class="" style="white-space: pre-wrap; height: 100%; margin: 0; padding: 0;" data-enlighter-language="php" data-enlighter-theme="enlighter" data-enlighter-group="" data-enlighter-title="" data-enlighter-linenumbers="true" data-enlighter-lineoffset="1" data-enlighter-highlight="">//////////////////////// Insert datas after create entry from Form  /////////////////////

add_action(&#039;frm_after_create_entry&#039;, &#039;copy_into_my_table&#039;, 20, 2);
function copy_into_my_table($entry_id, $form_id){ 
	switch_to_blog(2);
	if($form_id == 2){ //change 4 to the form id of the form to copy
		global $wpdb;
		$values = array(
		&#039;col_name&#039;         =&gt; $_POST[&#039;item_meta&#039;][24], 
		&#039;col_name&#039;         =&gt; $_POST[&#039;item_meta&#039;][25], 
		&#039;col_name&#039;         =&gt; $_POST[&#039;item_meta&#039;][22],
		&#039;col_name&#039;         =&gt; $_POST[&#039;item_meta&#039;][21],
		&#039;col_name&#039;         =&gt; $_POST[&#039;item_meta&#039;][26],
		&#039;col_name&#039;         =&gt; $_POST[&#039;item_meta&#039;][23],
		&#039;col_name&#039;         =&gt; &#039;&#039;,
		&#039;col_name&#039;         =&gt; &#039;&#039;, 
		&#039;col_name&#039;         =&gt; $_POST[&#039;item_meta&#039;][27],
		);
		//replace 25 and 26 with the field ids of the Formidable form. Change col_name to the column names in your table
		$wpdb-&gt;insert(&#039;wpeo_LDAAnalytics&#039;, $values); 
	}
	restore_current_blog();
}</pre></div>
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>En conclusion, c&#8217;est merveilleux d&#8217;insérer des données dans une table WordPress, cela permet par exemple, d&#8217;avoir une copie des données formulaires, ou pourquoi pas de proposer des statistiques pour vos clients.</p>

		</div>
	</div>
</div></div></div></div>
</div><p>The post <a href="https://themespress.ca/creer-une-entree-table-venant-dun-formulaire-formidable/">Table WordPress – Entrées d’un formulaire Formidable</a> first appeared on <a href="https://themespress.ca">Themespress</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://themespress.ca/creer-une-entree-table-venant-dun-formulaire-formidable/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
