More
    Home Blog

    CMS Connect: Salesforce / WordPress Integration

    0

    I recently did a project for a client where they wanted to be able to link their WordPress content into their Salesforce community. This possible using Salesforce’s CMS Connect feature.

    While there are many articles online on how to do this if you’re using a WordPress hosted WordPress site, there isn’t a lot of updated information on how to connect Salesforce and WordPress when the WordPress site is self-hosted. Here’s how to do it.

    Step 1: Cross-Origin Resource Sharing (CORS)

    The first step in this process is to whitelist the domain in CORS.

    1. Go to Salesforce Setup
    2. Type in CORS in the Quick Find box
    3. Click on CORS under Security
    4. Click the “New” button
    5. Enter the blog’s domain

    Step 2: Create a Connection

    The second step is to create the connection between Salesforce and WordPress.

    1. Go to Community Workspaces
    2. Click on Content Management
    3. Click on CMS Connect
    4. Click the “New” button
    5. Enter the following fields
      • Name = Any Name
      • CMS Source = WordPress
      • Connection Type = Public
      • Server URL = <Your WordPress Blog URL>
      • JSON
        • Content Type Name = <Any Content Type Name>
        • Content List
          • Name = Any Name
          • Path = wp-json/wp/v2/posts?per_page={itemsPerPage}&page={pageNumber}
          • Node Path = None (If this doesn’t work, check the JSON for the path)
    6. Click Save

    Step 3: Add Component to Page

    The final step is to add a component to the community page and configure it.

    1. Go into Community Experience Builder
    2. Click on the Lightning Bolt Icon for Components
    3. Drag and drop CMS Connect (JSON) into the page
    4. Configure CMS Connect (JSON) with the following settings
      • CMS Source = Select the CMS Source you just created
      • JSON Content = Select the JSON Content you just created
      • Content List layout = Grid
        • Items Per Page = 6 (or any you’d like)
        • Columns = 3 (or any you’d like)
      • Content List Item Layout
        • Content List Item Layout = Card
        • Title = @title/rendered
        • Published On = @date
        • Body = @excerpt/rendered
        • Image Source = @jetpack_featured_media_url (refer to your JSON if you don’t use Jetpack)
      • Navigation
        • Link Text = Read More
        • Type = External URL
        • URL = @link

    Once this is done and you click anywhere on the page, content from the WordPress website should automatically populate on your Salesforce Community. Enjoy!

    Welcome to My Blog!

    0

    Hello!

    Welcome to Sam Chen’s wonderful blog! I wanted to create this blog in order to share my work, hobbies, and anything else on my mind. I’ve heard journaling is a thing these days, so let’s give it a shot.

    With that out of the way, this is post #1. Yay.

    – Sam