WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Need Blank or Dummy Function Reference for Add_Filter (8 posts)

  1. imagiscapeca
    Member
    Posted 6 years ago #

    I want to place a plugin's button just beneath my title.
    The plugin hooked into the_content, but that placed it beneath the content.
    I tried the_title, but that placed it on the same line as the title, and made the plugin's button appear in my "recent posts" list.
    I moved the_author to be just beneath the title, and I tried the_author, but that shows up in some places it shouldn't, such as in wp-admin's list of posts.

    If I used author_email then the plugin's button would not appear where I don't want it, but the author email will appear where I don't want it, so I need a database reference that is blank.
    I tried role_has_cap but inexplicably that did nothing at all.
    I considered invoking a reference but then rendering it "visibility:hidden", but that would hide the plugin's button too.

    Is there a blank/empty or dummy function reference I can use for add_filter?

  2. imagiscapeca
    Member
    Posted 6 years ago #

    I have read http://codex.wordpress.org/Plugin_API/Filter_Reference, but that didn't help me with this question.

  3. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    Errr... what the heck are you talking about?

    Sorry, but your post is about as clear as mud. What are you trying to filter and why? What button? What code are you using? Where are you trying to put it?

  4. imagiscapeca
    Member
    Posted 6 years ago #

    (The plugin I am modifying is sds-talkr, which lets people listen to a post. I reduced the plugin from ~8000 bytes to ~500 and it works perfectly, except it has the same problem it always had - it's at the bottom of my post.)

  5. imagiscapeca
    Member
    Posted 6 years ago #

    The button is marked "Listen". If someone clicks the button, an audio version of the blog post is played.

  6. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    So, you want to put it in front of your content?

    If so, just change this line:

    function sds_Talkr($parm) {
    ...
      return $parm.$my_content;
    }

    To this:

    function sds_Talkr($parm) {
    ...
      return $my_content.$parm;
    }
  7. imagiscapeca
    Member
    Posted 6 years ago #

    Simple. Sweet.

    I'm not sure what $parm means, and I found no results at http://wordpress.org/search/parm. I expect something this basic must be documented somewhere, but FYI, I could not find it via google or wordpress.org. Perhaps it is an ad hoc-defined variable used only by sds-talkr. ?

    Thanks.

  8. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    Well, it's sorta basic. It's basic PHP.

    I loaded up the plugin and read the code. The "$parm" is the first input parameter to the function. Being that you're writing a filter, it would contain the original whatever you're filtering. In this case, the content. So if you want something before the content, you need to append the content to it, not the other way around.

Topic Closed

This topic has been closed to new replies.

About this Topic