Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Linked List Plugin by Shawn Penn and Thematic Theme WordPress

  • SOLVED

Hello Forum,

I would like to know how to enable in the Thematic Framework the plugin by Jonathan Penn called Linked List Url Plugin which was in github but I have it installed on my site and it works perfectly with 99% of WP Themes but now I'm using Thematic and the skin NeuticaPlus and I'm a bit lost as I can't find the regular index.php, single.php files common to all WP Themes. I understand that Thematic is a framework and I was able to install it on Thesis and Canvas(from Woothemes) without a hiccup but I'm stumped on this Framework.

Here is the actual code of the Plugin
<?php
/**
* @package Linked List
* @author Jonathan Penn
* @version 1.0
*/
/*
Plugin Name: Linked List
Plugin URI: http://github.com/jonathanpenn/wordpress-linked-list-plugin
Description: Have designated posts act like the "Linked List" posts on Daring Fireball. Set the custom field "linked_list_url" to any desired destination on a post. The permalink then becomes that destination. Affects RSS feeds automatically and provides functions you can use in your template to control the layout if the post is a normal post, or a linked-list post".
Author: Jonathan Penn
Version: 1.0
Author URI: http://wavethenavel.com
*/

// Called to see if the current post in the loop is a linked list
function is_linked_list()
{
$url = get_post_custom_values('linked_list_url');
if (empty($url)) {
return false;
} else {
return true;
}
}

function get_the_linked_list_link()
{
$url = get_post_custom_values("linked_list_url");
return $url[0];
}

function the_linked_list_link()
{
echo get_the_linked_list_link();
}

?>


Basically I find the following:

<h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>

and replace with this code:

<?php if (is_linked_list()): ?>
<h1><a href="<?php the_linked_list_link() ?>"><?php the_title(); ?></a></h1>
<?php else: ?>
<h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>
<?php endif; ?>

And once I do that wherever I want the Linked Post to take effect it works 100% beautifully.

When I create a post on WP I setup the custom field called: linked_list_url and then input the outgoing link, whichever it happens to be, sometimes I even add a little ascii symbol to denote that is a linked list post and voila.

Ok so that the background and the code, now here's my goal. Is to first, enable it, and secondly to add a meta post field called "Jump to" and then the the following: Linked   ➚

Which should look like this on my Post Meta Field:

Jump to "Linked ➚" which should be bold as its a live link but which is executed of the custom filed "linked_list_url"

Below is my attempt in a previous theme which was <strong>unsuccessful</strong> but I'm thinking its something like that:

<li>Jump to <?php if (is_linked_list()): ?>
<a href="<?php the_linked_list_link() ?>">Linked   ➚</a></li>

But I'm supposing that its not referencing the custom field because the aforementioned code links out to a 404 error page.

So to clarify, it should show the Post Meta Jump to <strong>Linked ➚</strong> if the post has the custom field active, if the post is not a linked list post then it should not show up in any Post Meta field.

Wow, anyway, that's the story, hope to hear from someone soon.

Reference Resources:
Theme: [[LINK href="http://themeshaper.com/"]]Latest Version of Thematic[[/LINK]]
[[LINK href="http://www.fthrwght.com/neuticaplus/"]]Neutica+ Child Theme for Thematic[[/LINK]]

cheers,
Jorge Ledesma

Answers (2)

2010-10-29

Maor Barazany answers:

Add this to your template's <strong>functions.php</strong> file



add_filter('post_link', 'tc_my_permalink');

function tc_my_permalink($permalink) {
global $post;
$my_link= get_post_meta($post->ID, 'linked_list_url', true);
if ($my_link != '')
$permalink = $my_link;
return $permalink;
}


Then, you may also deactivate the plugin, it won't be necessary , this code will do it to all posts that has value in this custom field <strong>linked_list_url</strong>.
If no value in this custom fields, so the regular permalink will be used.

Hope it helps


Maor Barazany comments:

Of course, with this solution you also don't need to change anything in your other template's files, such as the index.php, single.php etc..


Maor Barazany comments:

btw: this way you can use with thematic or with any other template, since it filters directlythe permalink, so you don't have to deal with changing template files, that will be override upon template upgrading.


Jorge Ledesma comments:

Thanks for replying Maor, I understand what your 1st comment after the code re: index.php and such but what I'd like is to not alter the index.php nor single.php but add a post meta field to with the
Jump to <strong>Linked ➚</strong> based on the fact that the post has a custom field linked_list_url and a value attached to it, ie. the url.

So when a reader comes to the page and open the post, such a field would show up if its marked as a linked list post via the custom field.