Timeline Express Pro Modifications

Revision as of 17:21, 7 February 2020 by Root (talk | contribs)

Timeline Express Pro is a WordPress Plugin that presents information in a timeline format. They refer to the individual timeline items as "announcements", which are similar to post or pages. By default, instead of displaying the full content of the "announcement" it displays an automatically generated "excerpt" (abbreviated version). By default this excerpt does not contain any HTML or ShortCode (only plain text). For people that do wish to display HTML in the "excerpts" they created an Add-On (Timeline Express HTML Excerpt Add On) that displays a custom "excerpt" of the timeline post which can include HTML content and ShortCode. Unfortunately this is a manual process. IE, the "excerpt" must be created and maintained separately from the main announcement.

That's the way it functions, and I used the features as they were to do something slightly different than what they had envisioned for their software. I used the custom "excerpt" as the main content of my timeline. I did this because I realized I could make each "announcement" its own self-contained webpage. And it worked great. But it also left another feature unneeded. That feature was the ability to display the full announcement. That wasn't something I needed because I was already displaying the full "announcement" with the Excerpt Add-On.

But then I came up with a use for it. The website I was developing was a biography site that required sources to be cited. I changed the name of the link at the bottom of each timeline item to "Sources & Additional Information". The result was I could write the main content in the Excerpt Add-On section and do the citations in the "attachment" section, all on one screen. Perfect. Convenient and it displayed everything just like I wanted it to be.

Everything was perfect until it came to SEO (Search Engine Optimization) that is. The SEO Plugin I was using only provided a sitemap for the full "announcement", not the content of the Excerpt Add-On. That meant only the reference sections were cataloged by search engines, not the content that was displayed to users. I thought I could work around it by having the SEO Plugin create sitemaps for each of the webpages the timelines were on. That didn't work either because the SEO software couldn't "see" the individual items on a timeline. So a page containing several dozen images resulted in a sitemap that had ZERO images. Crap!

How to fix this?


The Fix(es)

The first thing that needed to be done was to swap everything in the "announcement" section with the content in the Excerpt Add-On section. I wasn't about to do a copy past on that for several hundred entries. The solution to that was to swap column data in two database tables with each other. But as I read, mySQL (MariaDB) doesn't have that capability like other database servers do. for mySQL, it has to be done in stages. I read a bunch of stuff from people who were experts in SQL server. For my purposes it was way to complex. To stay within my abilities, I decided to create a couple of temporary tables and copy the data to them, and then copy from the temporary tables to the places I wanted to put the data. To make things even easier, I used phpMyAdmin.

  • First, backup the database: Select Database in phpMyAdmin, Export Tab, use defaults, Go and save to a location
  • During the above step I noticed that the database had the incorrect collation defined, so I changed it to the WordPress recommended utf8mb4_unicode_ci setting: Select Database in phpMyAdmin, Operations Tab, Collation Section
  • Create two temporary tables, TT1 and TT2 (as in Temporary Table 1 and 2): Select Database in phpMyAdmin, immediately under it select New, and create three columns with the following settings
    • TT1 (duplicating the necessary columns from the WordPress postmeta table);
      • Name: post_id, Type: bigint, Length/Values: 20
      • Name: meta_key, Type: varchar, Length/Values: 255
      • Name: meta_value, Type: longtext, , Length/Values: Leave it Blank
      • Save it
      • Create an Index on Column 1: Go, Index Choice: PRIMARY
    • TT2 (duplicating the necessary columns from the WordPress posts table);
      • Name: ID, Type: bigint, Length/Values: 20
      • Name: post_type, Type: varchar, Length/Values: 20
      • Name: post_content, Type: longtext, Length/Values: Leave it Blank
      • Save it
      • Create an Index on Column 1: Go, Index Choice: PRIMARY
  • Use a SQL statement to copy the data from the postmeta Table to TT1 Table: Select Database in phpMyAdmin, SQL Tab, Go, with the following SQL statement;
  • INSERT INTO TT1 (post_id, meta_key, meta_value)
    SELECT post_id, meta_key, meta_value
    FROM wp_postmeta
    WHERE meta_key = 'announcement_custom_excerpt';
  • Use a SQL statement to copy the data from the posts Table to TT2 Table: Select Database in phpMyAdmin, SQL Tab, Go, with the following SQL statement;
  • INSERT INTO TT2(ID, post_content, post_type)
    SELECT ID, post_content, post_type
    FROM wp_posts
    WHERE post_type = 'te_announcements';
    The number of rows copied into TT1 and TT2 should be the same
  • Use a SQL statement to copy the data from the TT1 Table to the posts Table: Select Database in phpMyAdmin, SQL Tab, Go, with the following SQL statement;
  • UPDATE wp_posts INNER JOIN TT1
    SET wp_posts.post_content = TT1.meta_value
    WHERE TEMPO.post_id = wp_posts.ID;
  • Use a SQL statement to copy the data from the TT2 Table to the postmeta Table: Select Database in phpMyAdmin, SQL Tab, Go, with the following SQL statement;
  • UPDATE wp_postmeta INNER JOIN TT2
    SET wp_postmeta.meta_value = TT2.post_content
    WHERE TEMPO2.ID = wp_postmeta.post_id AND wp_postmeta.meta_key = 'announcement_custom_excerpt';


OK, that solves the SEO issue because the sitemap now recognizes all the individual items and images because they also have their own individual URLs and "slugs". But what was displayed to users was now the citations instead of the content I wanted to display. That involved burrowing into the PHP code for the Add-On and making a small change.