Answers.Body: <p>You can create a Search kit to display number for Memberships and use shortcode to display on pages or widget</p>
  <p>Search kit import:</p>
  <pre><code>[
    [
      &quot;SavedSearch&quot;,
      &quot;save&quot;,
      {
        &quot;records&quot;: [
          {
            &quot;name&quot;: &quot;Member_count&quot;,
            &quot;label&quot;: &quot;Member count&quot;,
            &quot;form_values&quot;: null,
            &quot;mapping_id&quot;: null,
            &quot;search_custom_id&quot;: null,
            &quot;api_entity&quot;: &quot;Membership&quot;,
            &quot;api_params&quot;: {
              &quot;version&quot;: 4,
              &quot;select&quot;: [
                &quot;COUNT(id) AS COUNT_id&quot;
              ],
              &quot;orderBy&quot;: [],
              &quot;where&quot;: [
                [
                  &quot;status_id:name&quot;,
                  &quot;IN&quot;,
                  [
                    &quot;New&quot;,
                    &quot;Current&quot;
                  ]
                ]
              ],
              &quot;groupBy&quot;: [
                &quot;Membership_MembershipType_membership_type_id_01.member_of_contact_id&quot;
              ],
              &quot;join&quot;: [
                [
                  &quot;MembershipType AS Membership_MembershipType_membership_type_id_01&quot;,
                  &quot;LEFT&quot;,
                  [
                    &quot;membership_type_id&quot;,
                    &quot;=&quot;,
                    &quot;Membership_MembershipType_membership_type_id_01.id&quot;
                  ]
                ]
              ],
              &quot;having&quot;: []
            },
            &quot;expires_date&quot;: null,
            &quot;description&quot;: null
          }
        ],
        &quot;match&quot;: [
          &quot;name&quot;
        ]
      }
    ],
    [
      &quot;SearchDisplay&quot;,
      &quot;save&quot;,
      {
        &quot;records&quot;: [
          {
            &quot;name&quot;: &quot;Member_count_Grid_1&quot;,
            &quot;label&quot;: &quot;Member count Grid 1&quot;,
            &quot;saved_search_id.name&quot;: &quot;Member_count&quot;,
            &quot;type&quot;: &quot;grid&quot;,
            &quot;settings&quot;: {
              &quot;colno&quot;: &quot;3&quot;,
              &quot;limit&quot;: 0,
              &quot;sort&quot;: [],
              &quot;pager&quot;: false,
              &quot;columns&quot;: [
                {
                  &quot;type&quot;: &quot;field&quot;,
                  &quot;key&quot;: &quot;COUNT_id&quot;,
                  &quot;dataType&quot;: &quot;Integer&quot;,
                  &quot;rewrite&quot;: &quot;[COUNT_id] Members&quot;
                }
              ],
              &quot;placeholder&quot;: 0
            },
            &quot;acl_bypass&quot;: false
          }
        ],
        &quot;match&quot;: [
          &quot;name&quot;,
          &quot;saved_search_id&quot;
        ]
      }
    ],
    [
      &quot;Afform&quot;,
      &quot;save&quot;,
      {
        &quot;records&quot;: [
          {
            &quot;name&quot;: &quot;afsearchMembers&quot;,
            &quot;requires&quot;: [],
            &quot;title&quot;: &quot;Members&quot;,
            &quot;description&quot;: &quot;&quot;,
            &quot;is_dashlet&quot;: false,
            &quot;is_public&quot;: false,
            &quot;is_token&quot;: false,
            &quot;permission&quot;: [
              &quot;access AJAX API&quot;
            ],
            &quot;type&quot;: &quot;search&quot;,
            &quot;entity_type&quot;: null,
            &quot;join_entity&quot;: null,
            &quot;contact_summary&quot;: null,
            &quot;summary_contact_type&quot;: null,
            &quot;icon&quot;: &quot;fa-list-alt&quot;,
            &quot;server_route&quot;: &quot;&quot;,
            &quot;redirect&quot;: null,
            &quot;create_submission&quot;: false,
            &quot;navigation&quot;: null,
            &quot;layout&quot;: &quot;&lt;div af-fieldset=\&quot;\&quot;&gt;\n  &lt;crm-search-display-grid search-name=\&quot;Member_count\&quot; display-name=\&quot;Member_count_Grid_1\&quot;&gt;&lt;/crm-search-display-grid&gt;\n&lt;/div&gt;\n&quot;
          }
        ]
      }
    ]
  ]
  </code></pre>
  <p>Shortcode:</p>
  <pre><code>[civicrm component=&quot;afform&quot; name=&quot;afsearchMembers&quot;]
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-09-28T23:08:53.550Z
Answers.Text: Thanks @Pradeep...The code works in Search Kit and when executed within Search Kit it brings back the correct results.....It looks like when I execute the shortcode I do not get anything. I am suspecting it is to do with Afform. My version of Afform in extensions is 0.5......how do I get this updated with the latest version 5.65.1 ?
Answers.UserDisplayName: markd
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-09-28T23:16:16.660Z
Answers.Text: Are you on Civi 5.65.1 ? If yes you will need to delete the extension from the extension folder and then clear CiviCRM cache. The afform extension now comes with Civi so there shouldn't be any code under your extension folder
Answers.UserDisplayName: Pradeep Nayak
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-09-28T23:48:23.990Z
Answers.Text: Yes I am on 5.65.1.....researching further I do not have afform directory in ~/wp-content/uploads/civicrm/ext.....the only directory  I have afform in is ~/wp-content/plugins/civicrm/civicrm/ext....do you need me to delete afform and its subdirectories in ~/wp-content/plugins/civicrm/civicrm/ext ??....thanks for you assistance..
Answers.UserDisplayName: markd
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-09-29T07:47:04.747Z
Answers.Text: I believe that there may be a problem with my last upgrade from 5.58 to 5.65.1....I will upgrade to 5.66.X next week when it is released. I will revert with my findings after that upgrade.
Answers.UserDisplayName: markd
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-09-29T10:35:02.303Z
Answers.Text: It should be under the extension directory where you place contrib extensions
Answers.UserDisplayName: Pradeep Nayak
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-09-28T15:52:21.073Z
Answers.LastActivityDate: 2023-09-28T15:52:21.073Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>We are running Wordpress 6.3.1 and Civicrm 5.65.1</p>
  <p>We would like to dynamically display the Total Member count on our Wordpress home page. We have different member categories and would like to display this as a total only.</p>
  <p>Is there an easy way to do this? Any help would be greatly appreciated.</p>
  <p>Thanks</p>
  
Tags: <wordpress><civimember><civireport><database>
Title: Display Total Membership in Wordpress home page
ThreadText: # Display Total Membership in Wordpress home page
  
  (Asked by: username_0 on 2023-09-28)
  
  We are running Wordpress 6.3.1 and Civicrm 5.65.1
  
  We would like to dynamically display the Total Member count on our Wordpress home page. We have different member categories and would like to display this as a total only.
  
  Is there an easy way to do this? Any help would be greatly appreciated.
  
  Thanks
  
  **Tags:** wordpress, civimember, civireport, database
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-09-28. Score: 1
  
  You can create a Search kit to display number for Memberships and use shortcode to display on pages or widget
  Search kit import:
  [
    [
      "SavedSearch",
      "save",
      {
        "records": [
          {
            "name": "Member_count",
            "label": "Member count",
            "form_values": null,
            "mapping_id": null,
            "search_custom_id": null,
            "api_entity": "Membership",
            "api_params": {
              "version": 4,
              "select": [
                "COUNT(id) AS COUNT_id"
              ],
              "orderBy": [],
              "where": [
                [
                  "status_id:name",
                  "IN",
                  [
                    "New",
                    "Current"
                  ]
                ]
              ],
              "groupBy": [
                "Membership_MembershipType_membership_type_id_01.member_of_contact_id"
              ],
              "join": [
                [
                  "MembershipType AS Membership_MembershipType_membership_type_id_01",
                  "LEFT",
                  [
                    "membership_type_id",
                    "=",
                    "Membership_MembershipType_membership_type_id_01.id"
                  ]
                ]
              ],
              "having": []
            },
            "expires_date": null,
            "description": null
          }
        ],
        "match": [
          "name"
        ]
      }
    ],
    [
      "SearchDisplay",
      "save",
      {
        "records": [
          {
            "name": "Member_count_Grid_1",
            "label": "Member count Grid 1",
            "saved_search_id.name": "Member_count",
            "type": "grid",
            "settings": {
              "colno": "3",
              "limit": 0,
              "sort": [],
              "pager": false,
              "columns": [
                {
                  "type": "field",
                  "key": "COUNT_id",
                  "dataType": "Integer",
                  "rewrite": "[COUNT_id] Members"
                }
              ],
              "placeholder": 0
            },
            "acl_bypass": false
          }
        ],
        "match": [
          "name",
          "saved_search_id"
        ]
      }
    ],
    [
      "Afform",
      "save",
      {
        "records": [
          {
            "name": "afsearchMembers",
            "requires": [],
            "title": "Members",
            "description": "",
            "is_dashlet": false,
            "is_public": false,
            "is_token": false,
            "permission": [
              "access AJAX API"
            ],
            "type": "search",
            "entity_type": null,
            "join_entity": null,
            "contact_summary": null,
            "summary_contact_type": null,
            "icon": "fa-list-alt",
            "server_route": "",
            "redirect": null,
            "create_submission": false,
            "navigation": null,
            "layout": "\n  \n\n"
          }
        ]
      }
    ]
  ]
  
  Shortcode:
  [civicrm component="afform" name="afsearchMembers"]
  
  > **Comments:**
  > **username_0**: Thanks @Pradeep...The code works in Search Kit and when executed within Search Kit it brings back the correct results.....It looks like when I execute the shortcode I do not get anything. I am suspecting it is to do with Afform. My version of Afform in extensions is 0.5......how do I get this updated with the latest version 5.65.1 ?  
  > **username_1**: Are you on Civi 5.65.1 ? If yes you will need to delete the extension from the extension folder and then clear CiviCRM cache. The afform extension now comes with Civi so there shouldn't be any code under your extension folder  
  > **username_0**: Yes I am on 5.65.1.....researching further I do not have afform directory in ~/wp-content/uploads/civicrm/ext.....the only directory  I have afform in is ~/wp-content/plugins/civicrm/civicrm/ext....do you need me to delete afform and its subdirectories in ~/wp-content/plugins/civicrm/civicrm/ext ??....thanks for you assistance..  
  > **username_0**: I believe that there may be a problem with my last upgrade from 5.58 to 5.65.1....I will upgrade to 5.66.X next week when it is released. I will revert with my findings after that upgrade.  
  > **username_1**: It should be under the extension directory where you place contrib extensions  
  
  ---
  
  