WordPress integration

This documentation is intended to help with the implementation of Internal Links modules in existing WordPress CMS using Graphite's Internal Links API. These implementation details are for the most recent version of Graphite's Internal Links API WordPress Plugin (v1.0.3)

Graphite's Internal Links API integration with WordPress

This is the most recent version of Graphite's Internal Links API WordPress Plugin

Implementation details

Instructions for Plugin version 1.0.3 (Latest Version)

  1. Get latest Graphite Internal Links API WordPress plugin version from a Graphite Project Manager

  2. Upload the plugin in the WordPress interface:

👍

Download the plugin

⚠️ Make sure you have someone familiar with your Wordpress instance before you make any changes.

Graphite Internal Links API Plugin for Wordpress. Last update: March 2023

  1. (Optional) In your theme, implement a function called graphite_render_links_html, this is an example of that function:
function graphite_render_links_html($links) {
    echo '<div class="gp-container">';
    echo  '<div class="title"><span>Related Posts</span></div>';
    echo '<div class="grid">';
    foreach ($links as $item) {
        echo "<a class=\"gp-link\" href=\"{$item->url}\">";
        echo "<div class=\"parent\">";
        echo "<div class=\"img\" style=\"background-image:url({$item->image_url})\" alt=\"{$item->title}\">&nbsp;</div>";
        echo "</div>";
        echo "<p class=\"label\">{$item->title}</p>";
        echo "</a>";
        echo "<a class=\"gp-sublink\" href=\"{$item->url}\">";
        echo "<span class=\"gp-sublink-text\">Read More</span>";
        echo "<span class=\"gp-sublink-text\">→</span>";
        echo "</a>";
    }
    echo '</div>';
    echo '</div>';
}

📘

Note: This is the default rendering, in case the theme doesn’t declare one.

👍

Need help rendering your theme files?

Graphite can provide support via a consultant if needed.
Contact us

  1. (Required) In your theme, implement a function called graphite_get_site_id, this function should return your site identifier in the Graphite platform.

Please obtain your Graphite Site ID from your project manager

function graphite_get_site_id() {
    return 'thenewyorktimes';
}

🚧

Missing function

If the function isn’t found the plugin will skip the execution.

  1. Modify your theme to call the Graphite Links plugin whenever the user visits a post page:
<?php
//... Your theme code
if(function_exists("gp_render_links")) {
    gp_render_links();
}


Graphite Growth™