• This is what I’m trying to do:

    A page has a thumbnail image

    On other pages, I want to include, shortcode-style, a link to other pages. I want this to be the thumbnail of the page I’m linking to.

    As a bonus point, I’d really love the format to be like..

    [pagelink id=pagenickname] but if it needs to be [pagelink id=334] that’s okay.

    this is what I have right now.

    <?php
    	function do_pagelink($atts) {
    
        extract(shortcode_atts(array(
            'id' => 1,
            'text' => ""  // default value if none supplied
        ), $atts));
    
        if ($text) {
            $url = get_permalink($id);
            return "<a href='$url'>$text</a>";
        } else {
           return get_permalink($id);
    
        }
    }
    add_pagelink ('sponsor', 'do_pagelink');
  • The topic ‘Include thumbnail on other page’ is closed to new replies.