Jump to content


Photo
- - - - -

How do I add YARPP Below each Auto-Excerpt?


  • Please log in to reply
11 replies to this topic

#1 onlinetracker

onlinetracker

    Super Member

  • Members

  • 154 posts
  • Country: Country Flag

Posted 29 June 2012 - 06:34 PM

I'm trying to add the YARPP plugin to display its related posts beneath each excerpt. Which file would i add it to? It has functions to call that are embedable... related_posts() is one of them.

#2 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 29 June 2012 - 08:09 PM

You'd have to create a hook for that. It's inadvisable to edit core files as they would be overwritten on update.

#3 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 29 June 2012 - 09:40 PM

Okay, not sure why you rejected that without a stated reason. But let's examine this. You're talking about editing the loop, in essence, which is fundamentally a WP function, not a PageLines issue. A hook could help you place the snippet of code for YARPP in the layout. However, the best place to edit this would be in the WP files. Again, if you edit core files, whether they're PL or WP, and an update is executed, then the file that was edited would be overwritten and your work lost. If you want information about the hooks, I'll be happy to point you in the right direction. Else the best method would be to ask the YARPP author how to edit the WP files.

#4 Simon_P

Simon_P

    Messer

  • Administrators
  • 8388607 posts
  • LocationDevon
  • Framework Version:2.0
  • Country: Country Flag

Posted 29 June 2012 - 09:51 PM

Install PageLines customize plugin.
edit wp-content/plugins/pagelines-customize/functions.php

Add:
add_action( 'pagelines_loop_after_excerpt', 'related_posts' );

Completely untested as I have no idea what YARPP is.

#5 onlinetracker

onlinetracker

    Super Member

  • Members

  • 154 posts
  • Country: Country Flag

Posted 29 June 2012 - 10:05 PM

I rejected the post because I asked a very specific question: "Which file would I add it to?" I also included the caveat that "It has functions to call..." but regardless of those two bits of information, I found the class.posts.php file (the answer to the first question) that allows me to simply inject "related_posts()" into which isn't that hard to redo when an update takes place. In the space that you ask me if I want to know about hooks, you could have just linked it:

Please Login or Register to see this Hidden Content



#6 onlinetracker

onlinetracker

    Super Member

  • Members

  • 154 posts
  • Country: Country Flag

Posted 29 June 2012 - 10:07 PM

@Simon Thanks. I'll try that solution. I have it working at the moment. Lets see if I can break it.

#7 Simon_P

Simon_P

    Messer

  • Administrators
  • 8388607 posts
  • LocationDevon
  • Framework Version:2.0
  • Country: Country Flag

Posted 29 June 2012 - 10:23 PM

Editing framework files is just wrong and not supported at all, that's why there are hundreds of actions and filters. Install the free action-map plugin.

#8 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 29 June 2012 - 10:28 PM

My initial reply was to point out the method, not to be silly or arrogant. My second reply was to be helpful, again, without trying to insult you. Since we do not support WordPress itself, nor customizations of WP files, I could not directly answer your question. That was properly directed solely to WP or the plugin author.

#9 onlinetracker

onlinetracker

    Super Member

  • Members

  • 154 posts
  • Country: Country Flag

Posted 29 June 2012 - 11:19 PM

@Simon I don't recall that plugin "action-map" so I'll hunt it down unless you link to it. I had already installed the pagelines-customization addon. I'm sure editing the core is wrong when there are so many moving parts between WP Core and PLFW. Adding the function didn't work, thanks again for taking a crack at it. YARPP = Yet Another Related Post Plugin, basically it parses posts for certain words and ranks them. Then it displays them at the end of each post. I want them displayed after the homepage excerpts since I don't link to content by pages on the site. I simply stuck related_posts() in the excerpt loop in class.posts.php and that did the job. I know it will disappear with the next update. Now that I think about it, it may have broken because that function.php hook would have put "related_posts()" exactly where I manually placed it. I put it right before the "); // Hook" in class.posts.php. But wouldn't it simply double the function, not break it?

#10 Simon_P

Simon_P

    Messer

  • Administrators
  • 8388607 posts
  • LocationDevon
  • Framework Version:2.0
  • Country: Country Flag

Posted 29 June 2012 - 11:24 PM

Please Login or Register to see this Hidden Content

Thats with that action i posted.

#11 onlinetracker

onlinetracker

    Super Member

  • Members

  • 154 posts
  • Country: Country Flag

Posted 30 June 2012 - 04:37 PM

@Simon I had errors appear as well when I used the Hook, but not when I inserted the function directly into class.posts.php. I've no idea why that would happen. Thanks for installing it and trying it out.

#12 Simon_P

Simon_P

    Messer

  • Administrators
  • 8388607 posts
  • LocationDevon
  • Framework Version:2.0
  • Country: Country Flag

Posted 30 June 2012 - 04:43 PM

Those errors are from wordpress debug, safe to ignore. Most, well nearly all plugin devs do not know what wordpress debug is lol. I have all my sites running with debug on. If any plugin spits out a single error, i delete it.