Jump to content

Hello and Combining PHP terms on Wordpress


betatech

Recommended Posts

Hello forum,

 

My name is Jorge and this is my first post. I joined to the forum in order to try to teach myself some PHP. My goal to be proficient enough to hack Wordpress files accurately. I love Wordpress but sometimes my knowledge of PHP keeps me back :). With that said let me pick your php skills right quick.

 

I'm using a a plugin called Linked List Url by Jonathan Penn and its installed on my WP Theme called Manifest. The purpose of the plugin is to link outside of my blog ie. Post Title, click it and it will jump to whatever url I've inputted in the custom field linked_list_url. Simple enough right. Well in order to get this to work properly with any WP theme certain files need to be hacked ie.

 

index.php

single.php

page.php

archive.php

 

Those files  are usually a piece of cake to just change the information that I need (I've become semi proficient on copy and pasting php commands lol)

 

Usually the change looks like this in 99% of Wordpress theme:

___________________________________________

 

Find

<div class="post">

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

 

Then…

Replace with

<div class="post">

<?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; ?>

___________________________________________

 

Doing the above as I mentioned works like a charm in most files but sometimes, like in this case, things change. Well on my test site called http://www.testsite.ledesmaweb.com I have it working well except on the single.php. Where I have the following code:

 

<h3 class="entry-title"><?php the_title(); ?></h3>

 

The above is the default code of the theme, so copy and pasting away I found a semi workable solution.

 

<h3 class="entry-title"><a href="<?php the_linked_list_link() ?>"><?php the_title(); ?></a>  &#x221E;</h3>

 

Now with this code, when you go to the single post page and if the post are linked list, then once you click on the title they will jump out to whatever url is denoted on the custom field linked_list_url. The problem I'm having is that it will treat all the post the same, even the ones that are NOT linked_list_url, the regular posts and adding the html codes at the end   &#x221E; which I use only to denote linked listed urls. My goal is for the regular post not to have(  &#x221E;) at the end of the post title.

 

My goal is to combine(<h3 class="entry-title"><a href="<?php the_linked_list_link() ?>"><?php the_title(); ?></a>  &#x221E;</h3>) with a proper directive that outputs correctly.

 

Meaning if the post is marked to be a Link List Post via "<?php the_linked_list_link() ?>" then put the "<?php the_title(); ?>" with this at the end "  &#x221E;" or if the post is just a regular post which I think just uses "<?php the_permalink() ?> then "<?php the_title(); ?>

 

It took me an hour to figure out how to make it link out and another hour trying to figure out how to do this but my efforts have proven ineffective and I've gotten a boat load of errors which I've corrected via my ftp and reverting back to what was there before, boy am I glad ftp works this way.

 

And folks this is where I'm stuck. I'm hoping someone can teach me this.

 

Thanks,

Jorge

 

ps. here is an example of what I'm talking about

 

Example one, a post that is not linked listed: http://testsite.ledesmaweb.com/2010/10/12/wonderful-aromas/

Example two, a linked listed post: http://testsite.ledesmaweb.com/2010/10/10/shawn-blanc-interview/

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.