Timeline Express Pro Modifications: Difference between revisions

mNo edit summary
mNo edit summary
Line 11: Line 11:
<br />
<br />


===The Fix(es)===
==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.
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.
=== "Swap" Table Data in the WordPress Database ===


*First, backup the database: Select Database in phpMyAdmin, Export Tab, use defaults, Go and save to a location
*First, backup the database: Select Database in phpMyAdmin, Export Tab, use defaults, Go and save to a location
Line 36: Line 38:
WHERE meta_key = 'announcement_custom_excerpt';
WHERE meta_key = 'announcement_custom_excerpt';
</syntaxhighlight>
</syntaxhighlight>
* 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;
 
*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;
<syntaxhighlight lang="text">
<syntaxhighlight lang="text">
INSERT INTO TT2(ID, post_content, post_type)
INSERT INTO TT2(ID, post_content, post_type)
Line 42: Line 45:
FROM wp_posts
FROM wp_posts
WHERE post_type = 'te_announcements';
WHERE post_type = 'te_announcements';
</syntaxhighlight>The number of rows copied into TT1 and TT2 should be the same
</syntaxhighlight>(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;
 
*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;
<syntaxhighlight lang="text">
<syntaxhighlight lang="text">
UPDATE wp_posts INNER JOIN TT1
UPDATE wp_posts INNER JOIN TT1
Line 49: Line 53:
WHERE TEMPO.post_id = wp_posts.ID;
WHERE TEMPO.post_id = wp_posts.ID;
</syntaxhighlight>
</syntaxhighlight>
* 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;
 
*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;
<syntaxhighlight lang="text">
<syntaxhighlight lang="text">
UPDATE wp_postmeta INNER JOIN TT2
UPDATE wp_postmeta INNER JOIN TT2
Line 56: Line 61:
</syntaxhighlight>
</syntaxhighlight>


=== Editing of Excerpt Add-On PHP Code ===
After hunting around in the PHP code for a couple of minutes I found the areas where I needed to make the change.  The change was to have the Excerpt Add-On retrieve data from the post Table instead of the postmeta Table.  Below is the original code from the ../wp-content/plugins/timeline-express-html-excerpt-add-on/timeline-express-html-exerpts-add-on.php File (with tabs and spacing removed);<syntaxhighlight lang="text">
public function replace_default_timeline_express_excerpt( $excerpt, $post_id ) {
// If the new custom excerpt is set, return it.
if ( get_post_meta( $post_id, 'announcement_custom_excerpt', true ) ) {
echo apply_filters( 'the_content', get_post_meta( $post_id, 'announcement_custom_excerpt', true ) );
return;
}
return $excerpt;
}
</syntaxhighlight>
The line with: echo apply_filters( 'the_content', get_post_meta( $post_id, 'announcement_custom_excerpt', true ) ); was replaced with the below two lines of code;<syntaxhighlight lang="text">
$AlternateSourceOfContent = get_post ( $post = $post_id, $output = 'OBJECT', $filter = 'raw');
echo apply_filters( 'the_content', $AlternateSourceOfContent->post_content );
</syntaxhighlight>
(The section of code on the first line to the right of the equal sign could have just been: get_post( $post_id ); but the above is the full syntax of the WordPress "get_post" function)
That involved burrowing into the PHP code for the Add-On and making a small change.


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.
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.