• Resolved powerup5

    (@powerup5)


    Hi,

    can I change the link direction to a diverent article instead of the default announcment ? So that maybe the link is directed to “article/category/id” ?

    Thank you !

    powerup

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Code Parrots

    (@codeparrots)

    HI Powerup5,

    You can certainly setup a redirect using wp_redirect and a few conditionals. At the moment, we don’t have a filter to alter the permalink to the post. We are actively working on a new version (v1.3.2), which should be out in the next day or so.

    This next release introduces a few new filters, including one to allow for the permalinks to be altered.

    I will post back here when we get that release pushed out, and can provide you with a code snippet.

    Thread Starter powerup5

    (@powerup5)

    Thanks codeparrots, it will be awesome ??

    Plugin Contributor Code Parrots

    (@codeparrots)

    Hi @powerup5,

    You can alter the permalink to the posts by using the new filter timeline_express_announcement_permalink.

    https://github.com/EvanHerman/timeline-express/blob/master/lib/helpers.php#L502

    This will also alter the ‘Read More’ link, if visible.

    Here is an example changing the post with ID 15 to link to google.com:

    
    function set_announcement_fifteen_to_google( $permalink, $post_id ) {
       
       if ( 15 === $post_id ) {
     
         return 'https://www.google.com';
    
       }
    
       return $permalink;
    
    }
    add_filter( 'timeline_express_announcement_permalink', 'set_announcement_fifteen_to_google', 10, 2 );
    

    You can change (or add more) post ID’s to specify which link. Feel free to alter it however you need to adjust where the announcement is linking to. We may build out an add-on in the near future so you can specify the external URL on the announcement edit page, to avoid having to write additional code.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change Link to article’ is closed to new replies.