Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 04-30-2009, 11:33 AM   #1
LQ Newbie
Registered: Aug 2004
Posts: 26

Rep: Reputation: 15
Tinkering with a WP Plugin - Yeah, I already asked over there.

I have asked the critters at comicpress and the official WP forums. I even mailed the author of the plugin (not blaming him since this is a side project). Blank stares all around.

I was looking for a clean way to generate a code box automagically for individual comics.

I ran across this and it half works. It generates the HTML for a link to the page.

Would it be possible to modify so it would generate something like this

<a href=""><img alt="Cyanide and Happiness, a daily webcomic" src="" border=0></a><br />Cyanide & Happiness @ <a href=""></a>

Could the below be modified to generate the HTML needed to show the comic in addition to the link?

// LinkToThisPage
// Copyright (c) 2008 Creative Real Estate Investing Guide
// Released under the GPL license
// This is an add-on for WordPress
// **********************************************************************
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// *****************************************************************

Plugin Name: LinkToThisPage
Plugin URI:
Description: The Link To This Page (BETA) WordPress plugin provides a quick, simple to use, and unobtrusive way for users to obtain a link to your page or post for their own web site. Questions on configuration, etc.? Make sure to read the README.
Version: 1.1
Author: Mike Ginese
Author URI:


// Hook wp_head to add css
add_action('wp_head', 'linktothispage_wp_head');

function linktothispage_wp_head() {

    echo '<link rel="stylesheet" type="text/css" media="screen" href="' . get_bloginfo('wpurl') . '/wp-content/plugins/linktothispage/lttp.css" />';


// Hook the content to add the widget
add_filter('the_content', 'linktothispage_display_hook');
add_filter('the_excerpt', 'linktothispage_display_hook');

function linktothispage_display_hook($content='') {

    if (
            is_single() or is_page()


            $content .= lttp_widget();

        return $content;


// The HTML to display
function lttp_widget() {
    global $post;

    $linktothispage = '<div class="lttp_header" id="lttp_header">' . "\n";
    $linktothispage .= '<a class="lttp_link" link="lttp_link" href = "javascript:void(0)" onclick = "document.getElementById(\'lttp_box\').style.display=\'block\';document.getElementById(\'lttp_header\').style.display=\'none\';document.getElementById(\'lttp_header2\').style.display=\'block\';document.getElementById(\'lttp_footer\').style.display=\'block\'"><img src="' . get_bloginfo('wpurl') . '/wp-content/plugins/linktothispage/link.png" border="0">&nbsp;Link to this page</a>' . "\n";
    $linktothispage .= '</div>' . "\n";
    $linktothispage .= '<div class="lttp_header2" id="lttp_header2">' . "\n";
    $linktothispage .= '<a class="lttp_link" link="lttp_link" href = "javascript:void(0)" onclick = "document.getElementById(\'lttp_box\').style.display=\'none\';document.getElementById(\'lttp_header\').style.display=\'block\';document.getElementById(\'lttp_header2\').style.display=\'none\';document.getElementById(\'lttp_footer\').style.display=\'none\'"><img src="' . get_bloginfo('wpurl') . '/wp-content/plugins/linktothispage/link.png" border="0">&nbsp;Link to this page</a>' . "\n";
    $linktothispage .= '</div>' . "\n";
    $linktothispage .= '<div class="lttp_box" id="lttp_box">' . "\n";
    $linktothispage .= '<div id="lttp_left" class="lttp_left">Copy the code below to your web site.</div>' . "\n";
    $linktothispage .= '<div id="lttp_right" class="lttp_right"><a class="lttp_link" link="lttp_link" href = "javascript:void(0)" onclick = "document.getElementById(\'lttp_box\').style.display=\'none\';document.getElementById(\'lttp_header\').style.display=\'block\';document.getElementById(\'lttp_header2\').style.display=\'none\';document.getElementById(\'lttp_footer\').style.display=\'none\'">x</a>&nbsp;</div>' . "\n";
    $linktothispage .= '<div id="lttp_dialog" class="lttp_dialog">' . "\n";
    $linktothispage .= '<textarea name="siteinfo" rows="6" wrap="virtual" style="overflow: hidden; width: 396px;"><a href="'.get_permalink($post->ID).'" title="'.str_replace('"', '\"', strip_tags(get_the_title())).'">'.str_replace('"', '\"', strip_tags(get_the_title())).'</a></textarea>' . "\n";
    $linktothispage .= '</div>' . "\n";
    $linktothispage .= '</div>' . "\n";
    $linktothispage .= '<div class="lttp_footer" id="lttp_footer">' . "\n";
    $linktothispage .= 'Get LinkToThisPage from the <a href="" title="LinkToThisPage">Creative Real Estate Investing Guide</a>.' . "\n";
    $linktothispage .= '</div>' . "\n";

    return $linktothispage;

I am still cutting my teeth on PHP so any advice would be greatly appreciated.

Sorry if this is a daft question


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tinkering With An Old 486 Woodsman Slackware 7 05-16-2009 05:01 PM
Best distro? (yeah, yeah...I know, but read on!) jiml8 Linux - Software 15 08-03-2008 08:15 AM
LXer: Yoper 3.0 requires some tinkering LXer Syndicated Linux News 0 06-28-2007 11:46 AM
looking for wireless pci that requires no tinkering? kewlmadisonguy Linux - Wireless Networking 4 05-29-2004 03:47 PM
blackdown's java plugin, yeah I tried that. scapeass Linux - Software 1 01-29-2004 09:37 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:40 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration