WordPress.org

Forums

WP Tiles
[resolved] Beta 1.0: Link to Webpage (4 posts)

  1. russdev
    Member
    Posted 1 year ago #

    Is it possible to get a tile to link to a webpage instead of linking to post or page?

    Russell

    https://wordpress.org/plugins/wp-tiles/

  2. Mike Martel
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Russell,

    I just added a filter to WP Tiles that makes this possible with little custom coding: every tile that links to a post gets its permalink through the filter wp_tiles_permalink with the parameter $post_id.

    To give you an idea, you can give a single post an external link (say, post id:12 and the link to WordPress.org) like this:

    add_filter( 'wp_tiles_permalink', 'my_theme_wp_tiles_permalink', 10, 2);
    function my_theme_wp_tiles_permalink( $ret, $post_id ){
        if ( !$ret && 12 === $post_id )
            $ret = 'http://wordpress.org/';
    
        return $ret;
    }

    You can of course make this more fancy using meta fields, but this is the basic idea.

    Let me know if it works out!

    Cheers,
    Mike

  3. russdev
    Member
    Posted 1 year ago #

    Sorry Mike I have just seen the reply. Where would you add this to main template of my wordpress theme or as part of wp-tiles. If part of wp-tiles whuch file?

    Cheers

    Russell

  4. Mike Martel
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Russell,

    You add it to your functions.php. The snippet as above will simply set http://wordpress.org as the link for post with ID 12 when displayed on tiles. You'd have to make some modifications to make it more flexible, but it's a start and shows how it's done :)

    Mike

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Tiles
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.