Timeline Express Pro Modifications: Difference between revisions

mNo edit summary
mNo edit summary
 
(2 intermediate revisions by the same user not shown)
Line 151: Line 151:
</syntaxhighlight>All of the odd \ (backslashes) in the $script_string code is the escape character for PHP.
</syntaxhighlight>All of the odd \ (backslashes) in the $script_string code is the escape character for PHP.


And there's also one more item to configure when using the POST method.  A dedicated page (WhatEverURL) needs to be created.  And the below code needs to be inserted to in order to only have the functionality run on the pages it is intended to run on;<syntaxhighlight lang="text">
===Forget the Above Methods and use a Lightbox===
But either of the two methods opens a new webpage.  That seems a bit clunky.  Why not do something far more slick like a Popup?  Well, as mentioned above there are issues with that.  And also mentioned above is a better solution.  Use a lightbox.  After installing the Featherlight Lightbox, insert the below PHP code into the theme's (or child theme's) functions.php file;<syntaxhighlight lang="text">
function generate_custom_read_more_link()
 
{
global $post;
// "Gets" the ID of the current post from the POSTS Table
$post_id_to_pass = get_the_ID();
// Original line: echo wp_kses_post( '<a href="' . get_the_permalink( $post->ID ) . '" class="custom-class">Read More</a>' );
 
echo '<a href="' . 'WhatEverRelativeURL?metapost_id=' . $post_id_to_pass . '" data-featherlight="iframe" data-featherlight-iframe-width="2000" data-featherlight-iframe-height="800" class="FeatherLightUsesThisURLsoNameItAppropriately">WhatEverTextOrLinkName</a>';
 
}
 
add_action( 'timeline-express-after-excerpt', 'generate_custom_read_more_link' );
</syntaxhighlight>
 
And there's also one more item to configure when using the "lightbox" method.  A dedicated page (WhatEverURL) needs to be created for the lightbox to open, with any custom CSS associated with making pages render correctly in a theme.  And the below code needs to also be inserted into the functions.php file in order to only have the functionality run on the pages it is intended to run on;<syntaxhighlight lang="text">
// This If Function is TRUE if the requested Page is for the intended links
// This If Function is TRUE if the requested Page is for the intended links
// When FALSE, the $CONTENT is simply returned as is with no changes
// When FALSE, the $CONTENT is simply returned as is with no changes
Line 190: Line 207:
add_filter ('the_content', 'display_sources_and_additional_information');
add_filter ('the_content', 'display_sources_and_additional_information');
</syntaxhighlight>
</syntaxhighlight>
===Forget the Above Methods and use a Lightbox===
But either of the two methods opens a new webpage.  That seems a bit clunky.  Why not do something far more slick like a Popup?  Well, as mentioned above there are issues with that.  And also mentioned above is a better solution.  Use a lightbox.  After installing the Featherlight Lightbox, insert the below PHP code into the theme's (or child theme's) functions.php file;<syntaxhighlight lang="text">
function generate_custom_read_more_link()
{
global $post;
// "Gets" the ID of the current post from the POSTS Table
$post_id_to_pass = get_the_ID();
// Original line: echo wp_kses_post( '<a href="' . get_the_permalink( $post->ID ) . '" class="custom-class">Read More</a>' );
echo '<a href="' . 'WhatEverRelativeURL?metapost_id=' . $post_id_to_pass . '" data-featherlight="iframe" data-featherlight-iframe-width="2000" data-featherlight-iframe-height="800" class="FeatherLightUsesThisURLsoNameItAppropriately">WhatEverTextOrLinkName</a>';
}
add_action( 'timeline-express-after-excerpt', 'generate_custom_read_more_link' );
</syntaxhighlight>


<br />
<br />