<?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>Users - ThemesPress</title>
	<atom:link href="https://themespress.ca/en/sujets/users/feed/" rel="self" type="application/rss+xml" />
	<link>https://themespress.ca/en/</link>
	<description>Experts en développement d’API, plugins et intégrations WordPress.</description>
	<lastBuildDate>Sat, 01 Oct 2022 19:07:16 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.4</generator>

<image>
	<url>https://themespress.ca/wp-content/uploads/2020/10/cropped-Favicon-Themepress.ca_-32x32.png</url>
	<title>Users - ThemesPress</title>
	<link>https://themespress.ca/en/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to Display WordPress User&#8217;s ID</title>
		<link>https://themespress.ca/en/how-to-display-wordpress-users-id/</link>
					<comments>https://themespress.ca/en/how-to-display-wordpress-users-id/#respond</comments>
		
		<dc:creator><![CDATA[Daniel]]></dc:creator>
		<pubDate>Thu, 25 Jun 2020 13:59:01 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Body]]></category>
		<category><![CDATA[Users]]></category>
		<guid isPermaLink="false">https://themespress.ca/?p=4004</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>In this tutorial, we will configure a function that will allow us to display WordPress admin users&#8217; IDs. We will use the following filter:  <a href="https://developer.wordpress.org/reference/hooks/manage_users_custom_column/" target="_blank" rel="noopener noreferrer">manage_users_custom_column</a></p>

		</div>
	</div>
<div id="ts-enlighterjs-container-7789205" 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-7789205" class="" style="white-space: pre-wrap; height: 100%; margin: 0; padding: 0;" data-enlighter-language="php" data-enlighter-theme="custom" data-enlighter-group="" data-enlighter-title="" data-enlighter-linenumbers="true" data-enlighter-lineoffset="1" data-enlighter-highlight="">function addo_custom_add_user_id_column($columns) {
    $columns[&#039;user_id&#039;] = &#039;User ID&#039;;
    return $columns;
}
add_filter(&#039;manage_users_columns&#039;, &#039;addo_custom_add_user_id_column&#039;);
//Adds Content To The Custom Added Column
function addo_show_user_id_column_content($value, $column_name, $user_id) {
    $user = get_userdata( $user_id );
    if ( &#039;user_id&#039; == $column_name )
        return $user_id;
    return $value;
}
add_filter(&#039;manage_users_custom_column&#039;,  &#039;addo_show_user_id_column_content&#039;, 10, 3);</pre></div>
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>After configuring this filter, you can also use <a href="https://developer.wordpress.org/reference/hooks/pre_get_users/" target="_blank" rel="noopener noreferrer">pre_get_users</a> in order to sort the users&#8217; IDs. <strong><a href="https://themespress.ca/utilisateurs-wordpress-trier-en-ordre-par-id/" target="_blank" rel="noopener noreferrer">WordPress users: Sort by ID</a></strong></p>

		</div>
	</div>
</div></div></div></div>
</div><p>The post <a href="https://themespress.ca/en/how-to-display-wordpress-users-id/">How to Display WordPress User’s ID</a> first appeared on <a href="https://themespress.ca/en/">ThemesPress</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://themespress.ca/en/how-to-display-wordpress-users-id/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Add Pages/Posts IDs In WordPress Admin Columns</title>
		<link>https://themespress.ca/en/adding-pages-posts-ids-wordpress-admin-columns/</link>
					<comments>https://themespress.ca/en/adding-pages-posts-ids-wordpress-admin-columns/#respond</comments>
		
		<dc:creator><![CDATA[Daniel]]></dc:creator>
		<pubDate>Tue, 09 Jun 2020 16:59:15 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Body]]></category>
		<category><![CDATA[Users]]></category>
		<guid isPermaLink="false">https://themespress.ca/?p=4006</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>With this tutorial, we will show you how to use two filters that will allow us to display the pages and posts ID in properly identified columns in the WordPress users section of your website. The first filter will build the properly identified column <a href="https://codex.wordpress.org/Plugin_API/Filter_Reference/manage_pages_columns" target="_blank" rel="noopener noreferrer">manage_pages_columns</a> and <a href="https://codex.wordpress.org/Plugin_API/Filter_Reference/manage_posts_columns" target="_blank" rel="noopener noreferrer">manage_posts_columns</a>.</p>
<p>Once that&#8217;s done, we want to display the IDs in our columns. Two more filters are required: <a href="https://codex.wordpress.org/Plugin_API/Action_Reference/manage_posts_custom_column" target="_blank" rel="noopener noreferrer">manage_posts_custom_column</a> and <a href="https://developer.wordpress.org/reference/hooks/manage_pages_custom_column/" target="_blank" rel="noopener noreferrer">manage_pages_custom_column</a>.</p>
<p>These filters can also be used for custom post types sometimes used to generate portfolios, testimonials, products, etc&#8230;</p>

		</div>
	</div>
<div id="ts-enlighterjs-container-6764783" 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-6764783" class="" style="white-space: pre-wrap; height: 100%; margin: 0; padding: 0;" data-enlighter-language="php" data-enlighter-theme="custom" data-enlighter-group="" data-enlighter-title="" data-enlighter-linenumbers="true" data-enlighter-lineoffset="1" data-enlighter-highlight="">add_filter( &#039;manage_pages_columns&#039;, &#039;pages_add_id_column&#039;, 5 );
add_action( &#039;manage_pages_custom_column&#039;, &#039;pages_id_column_content&#039;, 5, 2 );
function pages_add_id_column( $columns ) {
   $columns[&#039;monid&#039;] = &#039;ID&#039;;
   return $columns;
}

function pages_id_column_content( $column, $id ) {
  if( &#039;monid&#039; == $column ) {
    echo $id;
  }
}


add_filter( &#039;manage_posts_columns&#039;, &#039;posts_add_id_column&#039;, 5 );
add_action( &#039;manage_posts_custom_column&#039;, &#039;posts_id_column_content&#039;, 5, 2 );
function posts_add_id_column( $columns ) {
   $columns[&#039;monid&#039;] = &#039;ID&#039;;
   return $columns;
}

function posts_id_column_content( $column, $id ) {
  if( &#039;monid&#039; == $column ) {
    echo $id;
  }
}</pre></div></div></div></div></div>
</div><p>The post <a href="https://themespress.ca/en/adding-pages-posts-ids-wordpress-admin-columns/">How to Add Pages/Posts IDs In WordPress Admin Columns</a> first appeared on <a href="https://themespress.ca/en/">ThemesPress</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://themespress.ca/en/adding-pages-posts-ids-wordpress-admin-columns/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Display an Author&#8217;s Post on a Page Template</title>
		<link>https://themespress.ca/en/display-an-authors-post-on-a-page-template/</link>
					<comments>https://themespress.ca/en/display-an-authors-post-on-a-page-template/#respond</comments>
		
		<dc:creator><![CDATA[Daniel]]></dc:creator>
		<pubDate>Sat, 11 Apr 2020 18:44:38 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Query]]></category>
		<category><![CDATA[Users]]></category>
		<guid isPermaLink="false">https://themespress.ca/?p=4193</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>With this tutorial, we will create a query which will display posts or post types of an author. This could be used in a scenario where a user wants to see their ads on an online classified advertising service.</p>
<p>First off, you must know that the <a href="https://developer.wordpress.org/themes/basics/template-hierarchy/" target="_blank" rel="noopener noreferrer">author.php</a> template could fill our need, however this is will be to create a more custom result.</p>
<p>First off, if not already done, you&#8217;ll need to create a <a href="https://developer.wordpress.org/themes/template-files-section/page-template-files/" target="_blank" rel="noopener noreferrer">template page in English</a>.</p>
<p>Once the template is ready to go, you will be able to add your query to it and create your loop. For that, we will use the <a href="https://developer.wordpress.org/reference/functions/get_posts/" target="_blank" rel="noopener noreferrer">get_posts</a> function to display our results.</p>
<p>In the example below, we have a news post type that displays this template which displays a user&#8217;s published news post. <br />
Simply replace News by your post type. You will then be able to edit the arguments such as pagination, etc&#8230;</p>

		</div>
	</div>
<div id="ts-enlighterjs-container-2786581" 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-2786581" 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="">&lt;?php
$args = array(
&#039;posts_per_page&#039; =&gt; 100,  // Limit to 5 posts
&#039;post_type&#039; =&gt; &#039;nouvelles&#039;,  // Query for the default Post type
&#039;order_by&#039; =&gt; &#039;post_date&#039;  // Order by date posted
);
$last_five_posts = get_posts( $args );

foreach ( $last_five_posts as $post ) : setup_postdata( $post ); 
?&gt;
&lt;?php /// Votre HTML / R&Eacute;SULTATS ICI ?&gt;
&lt;?php endforeach; wp_reset_postdata(); ?&gt;</pre></div></div></div></div></div>
</div><p>The post <a href="https://themespress.ca/en/display-an-authors-post-on-a-page-template/">Display an Author’s Post on a Page Template</a> first appeared on <a href="https://themespress.ca/en/">ThemesPress</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://themespress.ca/en/display-an-authors-post-on-a-page-template/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Sort WordPress users by ID</title>
		<link>https://themespress.ca/en/sort-wordpress-users-by-id/</link>
					<comments>https://themespress.ca/en/sort-wordpress-users-by-id/#respond</comments>
		
		<dc:creator><![CDATA[Daniel]]></dc:creator>
		<pubDate>Thu, 27 Feb 2020 17:08:16 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Users]]></category>
		<guid isPermaLink="false">https://themespress.ca/?p=4201</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>This tutorial will show you how to sort WordPress users by ID and DESC. Thanks to the <a href="https://developer.wordpress.org/reference/hooks/pre_get_posts/" target="_blank" rel="noopener noreferrer">pre_get_posts</a> hook, it will allow us to custom a query for and posts types. The <a href="https://developer.wordpress.org/reference/hooks/pre_get_posts/" target="_blank" rel="noopener noreferrer">pre_get_posts</a> can generate WordPress admin results; i.e. on the website&#8217;s front end.In this case, we will be using <a href="https://developer.wordpress.org/reference/hooks/pre_get_users/" target="_blank" rel="noopener noreferrer">pre_get_users</a> which is designed to return users.</p>
<p>In the example below, we&#8217;ll be looking to sort our WordPress users into a table. First off, we need a condition that indicates that if the user isn&#8217;t an Admin, do nothing.</p>
<p>Then we use two arguments: the orderby ID and the order DESC.<br />
Voilà! Your users are now sorted at the top of the table with the newly created users first.</p>

		</div>
	</div>
<div id="ts-enlighterjs-container-6852637" 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-6852637" 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="">///////////////////////////// Admin users order by ID and DESC Pre Get Users //////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
 
function sitebook_order_users_by_id( $query ) {
 
   //Check that we are in admin otherwise return
   if( !is_admin() ) {
      return;
   }
 
   // We are changing the query_vars to reorder
   $query-&amp;gt;query_vars[&#039;orderby&#039;] = &#039;ID&#039;;
   $query-&amp;gt;query_vars[&#039;order&#039;]   = &#039;DESC&#039;;
 
   // We need to remember to return the altered query.
   return $query;
}
// Lets apply our function to hook.
add_action( &#039;pre_get_users&#039;, &#039;sitebook_order_users_by_id&#039; );</pre></div></div></div></div></div>
</div><p>The post <a href="https://themespress.ca/en/sort-wordpress-users-by-id/">Sort WordPress users by ID</a> first appeared on <a href="https://themespress.ca/en/">ThemesPress</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://themespress.ca/en/sort-wordpress-users-by-id/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Sort by Post Type in WordPress Admin Columns</title>
		<link>https://themespress.ca/en/sort-by-post-type-in-wordpress-admin-columns/</link>
					<comments>https://themespress.ca/en/sort-by-post-type-in-wordpress-admin-columns/#respond</comments>
		
		<dc:creator><![CDATA[Daniel]]></dc:creator>
		<pubDate>Mon, 12 Nov 2018 11:55:03 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Body]]></category>
		<category><![CDATA[Users]]></category>
		<guid isPermaLink="false">https://themespress.ca/?p=4217</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>With this tutorial, we will show you how to sort post type results in WordPress admin by sorting with a post type meta key in numerical order. </p>
<p>So let&#8217;s say for example that you want to sort by ID the job post type from highest to lowest. First, we will need to build the necessary columns for our Job post type.</p>
<p>So here&#8217;s to adding our id-job column; make sure to change the post type name. </p>

		</div>
	</div>
<div id="ts-enlighterjs-container-5808241" 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-5808241" 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="">//////////////////////////////////// Admin columns Informations Post Type /////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
add_filter( &#039;manage_emplois_posts_columns&#039;, &#039;themespress_custom_mycpt_columns&#039; );
function themespress_custom_mycpt_columns( $columns ) {
  $columns[&#039;id-emploi&#039;] = __( &#039;Id de l&#039;emploi&#039;, &#039;themespress&#039; );
  return $columns;
}</pre></div>
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>We will display our results in the column by following the instruction; if we want to add more columns.</p>

		</div>
	</div>
<div id="ts-enlighterjs-container-2524535" 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-2524535" 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_filter( &#039;manage_emplois_posts_columns&#039;, &#039;themespress_custom_edit_mycpt_columns&#039; );
function themespress_custom_edit_mycpt_columns( $columns ) {
//////////////////////////////////// Admin columns Informations Post Type /////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
  switch ( $column ) {
    case &#039;id-emploi&#039; :
	// On appelle notre meta key
        echo get_post_meta( $post_id, &#039;id-emploi&#039;, true );
	break;
    }
}</pre></div>
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>We will now do our parse_query that will enable us to sort our Job ID from highest to lowest. We add a condition &#8220;return&#8221; if we are not in the WP admin.</p>

		</div>
	</div>
<div id="ts-enlighterjs-container-7403616" 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-7403616" 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_filter( &#039;parse_query&#039;, &#039;themespress_custom_post_sort&#039; );
function themespress_custom_post_sort($query) {
 
    if ( ! is_admin() )
        return $query;
 
    global $current_screen;
    if ( isset( $current_screen ) &amp;&amp; &#039;emplois&#039; === $current_screen-&gt;post_type ) {
        $query-&gt;query_vars[&#039;orderby&#039;]  = &#039;meta_value&#039;;
        $query-&gt;query_vars[&#039;meta_key&#039;] = &#039;id-emploi&#039;;
        $query-&gt;query_vars[&#039;order&#039;]    = &#039;DESC&#039;;
    }
}</pre></div></div></div></div></div>
</div><p>The post <a href="https://themespress.ca/en/sort-by-post-type-in-wordpress-admin-columns/">Sort by Post Type in WordPress Admin Columns</a> first appeared on <a href="https://themespress.ca/en/">ThemesPress</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://themespress.ca/en/sort-by-post-type-in-wordpress-admin-columns/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>WooCommerce: Displaying Stats Under The Client Column</title>
		<link>https://themespress.ca/en/woocommerce-displaying-stats-under-the-client-column/</link>
					<comments>https://themespress.ca/en/woocommerce-displaying-stats-under-the-client-column/#respond</comments>
		
		<dc:creator><![CDATA[Daniel]]></dc:creator>
		<pubDate>Sat, 25 Aug 2018 20:58:01 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Users]]></category>
		<category><![CDATA[WooCommerce]]></category>
		<guid isPermaLink="false">https://themespress.ca/?p=4256</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>With this tutorial, we will show you how to display your WooCommerce customer stats; for example the number of orders or the amount of money a customer spent on your online store. </p>
<p><a href="https://woocommerce.com/" target="_blank" rel="noopener">Woocommerce</a> is the number 1 e-commerce WordPress plugin for online stores.</p>
<p>WooCommerce Hooks for:<br />
Displaying the total number of orders: <a href="http://hookr.io/functions/wc_get_customer_order_count/" target="_blank" rel="noopener"><strong>wc_get_customer_order_count</strong></a><br />
The amount of money spent on your store: <a href="http://hookr.io/functions/wc_get_customer_total_spent/" target="_blank" rel="noopener"><strong>wc_get_customer_total_spent</strong></a></p>
<p>Now that we know which hooks to use, we will create two columns in the user tables with the <strong>manage_users_columns</strong> and the <strong>manage_users_custom_column</strong> filters where the former will display both columns and the latter will allow us to generate the results.</p>

		</div>
	</div>
<h2 style="text-align: left" class="vc_custom_heading vc_do_custom_heading" >Woocommerce : Afficher des informations dans la colonne utilisateur</h2><div id="ts-enlighterjs-container-3257773" 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-3257773" 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="">///////////////////////////////// Woocommerce users results columns /////////////////////////// 
function add_user_details_columns($columns) {
$columns[&#039;user_orders&#039;] = &#039;Orders&#039;;
$columns[&#039;user_total_spent&#039;] = &#039;Total Spent&#039;;
return $columns;
}
 
function show_user_details_column_content($value, $column_name, $user_id) {
if (&#039;user_orders&#039; == $column_name)
return wc_get_customer_order_count($user_id);
else if (&#039;user_total_spent&#039; == $column_name)
return wc_price(wc_get_customer_total_spent($user_id));
return $value;
}
 
function add_order_details_to_user_list() {
add_filter(&#039;manage_users_columns&#039;, &#039;add_user_details_columns&#039;);
add_action(&#039;manage_users_custom_column&#039;, &#039;show_user_details_column_content&#039;, 10, 3);
}
 
add_action(&#039;admin_init&#039;, &#039;add_order_details_to_user_list&#039;);
 
////////////////////////////////////////////////////////////////////////////////////////////////</pre></div>
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>Alternatively, you can also use various plugins to display your WooCommerce stats such as <a href="https://wordpress.org/plugins/woo-classement/" target="_blank" rel="noopener"><strong>Woocommerce Classement</strong></a> or <a href="https://wordpress.org/plugins/sales-report-for-woocommerce/" target="_blank" rel="noopener"><strong>Sales Report for WooCommerce</strong></a>.</p>

		</div>
	</div>
</div></div></div></div>
</div><p>The post <a href="https://themespress.ca/en/woocommerce-displaying-stats-under-the-client-column/">WooCommerce: Displaying Stats Under The Client Column</a> first appeared on <a href="https://themespress.ca/en/">ThemesPress</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://themespress.ca/en/woocommerce-displaying-stats-under-the-client-column/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>WordPress: Redirecting a Private Page to Customer Account Page</title>
		<link>https://themespress.ca/en/wordpress-redirecting-a-private-page-to-customer-account-page/</link>
					<comments>https://themespress.ca/en/wordpress-redirecting-a-private-page-to-customer-account-page/#respond</comments>
		
		<dc:creator><![CDATA[Daniel]]></dc:creator>
		<pubDate>Wed, 11 Apr 2018 21:16:06 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Paging]]></category>
		<category><![CDATA[Users]]></category>
		<guid isPermaLink="false">https://themespress.ca/?p=5052</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>With this tutorial, we will create a function <strong>that will redirect a private page</strong>. By default all private pages are password protected and limited to WordPress users. If non-connected users try to access it, it redirects to a 404.</p>
<p>While we want to keep the same default conditions when we&#8217;re testing our page privately, we want to redirect it to our homepage.</p>
<p>With the new function that we need to add into our <strong>functions.php file</strong>, we need to validate <strong>two conditions</strong>: first if we land on the 404 and then we validate that our query is valid for a private page.</p>

		</div>
	</div>
<h2 style="text-align: left" class="vc_custom_heading vc_do_custom_heading" >WordPress: Redirect Private Page to Customer Account Page</h2><div id="ts-enlighterjs-container-3625842" 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-3625842" 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="">////////////////////////////////// Redirect private page  ////////////////////////////////////////

add_action(&#039;template_redirect&#039;, &#039;themespress_private_content_redirect_to_login&#039;, 9);
function themespress_private_content_redirect_to_login() {
  global $wp_query, $wpdb;
  if (is_404()) {
    $private = $wpdb-&gt;get_row($wp_query-&amp;gt;request);
    $location = home_url();
    if( &#039;private&#039; == $private-&gt;post_status  ) {
      wp_safe_redirect($location);
      exit;
    }
  }
}</pre></div>
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>As you can see, we are fulfilling the requirements and now we need to create a new variable that we&#8217;ll call <strong>$location</strong> and determine the redirect path. On our example, we used <strong><a href="https://codex.wordpress.org/Function_Reference/home_url" target="_blank" rel="noopener">home_url()</a></strong>.</p>
<p>When we validate that is a private page, we trigger the wp_safe_redirect from the <strong>$location</strong> variable.</p>

		</div>
	</div>
</div></div></div></div>
</div><p>The post <a href="https://themespress.ca/en/wordpress-redirecting-a-private-page-to-customer-account-page/">WordPress: Redirecting a Private Page to Customer Account Page</a> first appeared on <a href="https://themespress.ca/en/">ThemesPress</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://themespress.ca/en/wordpress-redirecting-a-private-page-to-customer-account-page/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Optimize the Security of your WP-Admin</title>
		<link>https://themespress.ca/en/optimizing-wp-admin-security/</link>
					<comments>https://themespress.ca/en/optimizing-wp-admin-security/#respond</comments>
		
		<dc:creator><![CDATA[Daniel]]></dc:creator>
		<pubDate>Sat, 07 Oct 2017 13:44:48 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Users]]></category>
		<guid isPermaLink="false">https://themespress.ca/?p=5137</guid>

					<description><![CDATA[<p>With this tutorial, we will show you how to improve and optimize the security of your WP-Admin/WP-Login. As you may or may not know, the WP-Login page is often being attacked by random queries in order for hackers to find a way into your website in order to trigger multiple Load Averages and subsequently crash [&#8230;]</p>
<p>The post <a href="https://themespress.ca/en/optimizing-wp-admin-security/">Optimize the Security of your WP-Admin</a> first appeared on <a href="https://themespress.ca/en/">ThemesPress</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>With this tutorial, we will show you how to improve and optimize the security of your WP-Admin/WP-Login.</p>
<p>As you may or may not know, the WP-Login page is often being attacked by random queries in order for hackers to find a way into your website in order to trigger multiple Load Averages and subsequently crash your website.</p>
<p>Below you&#8217;ll find a simply trick that can be done within a few minutes. The end goal being to change your login page&#8217;s URL so that the would be hacker be sent to a different page.</p>
<p>First being, you&#8217;ll need to install the <a href="https://en.wordpress.org/plugins/protect-wp-admin/" target="_blank" rel="noopener">Protect Your Admin</a> plugin and then change the parameter of your login URL.</p>
<p>This plugin will turn away would be hackers so that they can&#8217;t make queries to your official login page.</p>
<p><strong>All attacks and malicious queries on &#8220;wp-admin&#8221; and &#8220;wp-login.php&#8221; will be redirected to the homepage while accessing the Admin of your website will only work via the authorized, custom URL.</strong>.</p>
<p>For the second step, we recommend to also redirect manage it via your cPanel in the <strong>Domains</strong> section, then <strong>Redirects</strong> and then creating 2 new redirects: <strong>mydomainname.com/wp-admin/</strong> to <strong>mydomainname.com/</strong> <strong>mydomainname.com/wp-login.php/</strong> to <strong>mydomainname.com/</strong></p><p>The post <a href="https://themespress.ca/en/optimizing-wp-admin-security/">Optimize the Security of your WP-Admin</a> first appeared on <a href="https://themespress.ca/en/">ThemesPress</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://themespress.ca/en/optimizing-wp-admin-security/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Hiding Post Type URL In Admin Pages</title>
		<link>https://themespress.ca/en/hiding-post-type-url/</link>
					<comments>https://themespress.ca/en/hiding-post-type-url/#respond</comments>
		
		<dc:creator><![CDATA[Daniel]]></dc:creator>
		<pubDate>Sat, 05 Aug 2017 16:19:26 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Functions]]></category>
		<category><![CDATA[Users]]></category>
		<guid isPermaLink="false">https://themespress.ca/?p=5197</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>With this tutorial, we&#8217;ll show you how to hide a Post Type&#8217;s URL so if you create a custom post type that doesn&#8217;t require the single, we might want to hide the URL from our customers.</p>
<p>Here&#8217;s the image.</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 fetchpriority="high" decoding="async" width="1085" height="85" src="https://themespress.ca/wp-content/uploads/2017/08/wsi-imageoptim-cacher.jpg" class="vc_single_image-img attachment-full" alt="" title="Cacher le permalien d’un post type coté admin WordPress" srcset="https://themespress.ca/wp-content/uploads/2017/08/wsi-imageoptim-cacher.jpg 1085w, https://themespress.ca/wp-content/uploads/2017/08/wsi-imageoptim-cacher-600x47.jpg 600w, https://themespress.ca/wp-content/uploads/2017/08/wsi-imageoptim-cacher-300x24.jpg 300w, https://themespress.ca/wp-content/uploads/2017/08/wsi-imageoptim-cacher-1024x80.jpg 1024w, https://themespress.ca/wp-content/uploads/2017/08/wsi-imageoptim-cacher-768x60.jpg 768w, https://themespress.ca/wp-content/uploads/2017/08/wsi-imageoptim-cacher-1320x103.jpg 1320w" sizes="(max-width: 1085px) 100vw, 1085px" /></div>
		</figure>
	</div>

	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>And then if you to optimize these results so your Post Types aren&#8217;t displayed in Google SERPs; a slider or hidden data for example. Make sure to check your variables in your function are (Click <a title="Créer un Post Type WordPress" href="/en/creating-a-custom-post-type/">here</a> to learn how to create a custom post type):</p>
<p>public =&gt; false,<br />
has_archive =&gt; false<br />
publicly_queryable =&gt; false</p>
<p>In our WordPress function, which we will implement in our functions.php or plugin core file, we will add a condition to hide the link if the Post Type is in the Admin head such as:</p>

		</div>
	</div>
<div id="ts-enlighterjs-container-6856612" 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-6856612" 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="">///////////////////////////////////////////// 
//////// Permalinks display no //////////////
/////////////////////////////////////////////
add_action(&#039;admin_head&#039;, &#039;votretheme_permalink_none&#039;);
function votretheme_permalink_none() {    
	global $post_type;    
	if ($post_type == &#039;CPT_NAME_HERE&#039; ) {        
	    echo &#039;&lt;style&gt;#edit-slug-box, #message a {display:none;}&lt;/style&gt;&#039;;
    } 
	elseif ($post_type == &#039;CPT_NAME_HERE&#039; ) { 
	    echo &#039;&lt;style&gt;#edit-slug-box, #message a, #post-status-info, #postdivrich {display:none;}&lt;/style&gt;&#039;;
	} 
}</pre></div>
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>You can also add a condition where all your Archive and Single post types are redirected to your homepage. That way Google won&#8217;t index those. If you don&#8217;t want to use this function, you can also do so via the highly recommended Yoast SEO plugin.</p>

		</div>
	</div>
<div id="ts-enlighterjs-container-4896615" 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-4896615" 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="">function votretheme_postype_redirect() {
    global $wp_query;
 
    // redirect from &#039;slideshow&#039; CPT to home page
    if ( is_archive(&#039;CPT_NAME_HERE&#039;) || is_singular(&#039;CPT_NAME_HERE&#039;) ) :
        $url   = get_bloginfo(&#039;url&#039;);
 
        wp_redirect( esc_url_raw( $url ), 301 );
        exit();
    endif;
}
 
add_action ( &#039;template_redirect&#039;, votretheme_postype_redirect&#039;, 1);</pre></div></div></div></div></div>
</div><p>The post <a href="https://themespress.ca/en/hiding-post-type-url/">Hiding Post Type URL In Admin Pages</a> first appeared on <a href="https://themespress.ca/en/">ThemesPress</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://themespress.ca/en/hiding-post-type-url/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Display number of posts per author</title>
		<link>https://themespress.ca/en/display-number-of-posts-per-author/</link>
					<comments>https://themespress.ca/en/display-number-of-posts-per-author/#respond</comments>
		
		<dc:creator><![CDATA[Daniel]]></dc:creator>
		<pubDate>Thu, 20 Apr 2017 21:39:39 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Query]]></category>
		<category><![CDATA[Users]]></category>
		<guid isPermaLink="false">https://themespress.ca/?p=6181</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>Display number of posts per author: </strong> With this tutorial, we will create a simply query that will allow you to display the number of posts per author on your author.php template.</p>
<p>In order to do so, we will use the <a href="https://codex.wordpress.org/Function_Reference/count_user_posts" target="_blank" rel="noopener">count user posts</a> WordPress function.</p>

		</div>
	</div>
<div id="ts-enlighterjs-container-2876063" 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-2876063" 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="">&lt;?php $user_post_count = count_user_posts( $userid , $post_type ); ?&gt;</pre></div>
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>We will take this example and tailor it to our query. First, we need to configure <strong>global $authordata;</strong> to fetch the authors&#8217; data. And then in a variable, we will use the author ID along with count_user_posts with our arguments.</p>
<p>In our example, our Post Type is called produits-listings.</p>

		</div>
	</div>
<div id="ts-enlighterjs-container-7480018" 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-7480018" 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="">&lt;?php 
global $authordata; 
//author id 
$post_author = $authordata-&gt;ID; 
//Ici nous ajoutons notre variable author ID + nom du Pot Type 
echo &#039;&#039; . count_user_posts( $post_author, &quot;produits-listings&quot; ); 
?&gt;</pre></div>
	<div class="wpb_text_column wpb_content_element" >
		<div class="wpb_wrapper">
			<p>Finally, the number of Post Type per author will be displayed within your author.php template. Nice and easy.</p>

		</div>
	</div>
</div></div></div></div>
</div><p>The post <a href="https://themespress.ca/en/display-number-of-posts-per-author/">Display number of posts per author</a> first appeared on <a href="https://themespress.ca/en/">ThemesPress</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://themespress.ca/en/display-number-of-posts-per-author/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
