• Resolved Jonathon N

    (@imagiscapeca)


    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?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter Jonathon N

    (@imagiscapeca)

    I have read https://codex.www.ads-software.com/Plugin_API/Filter_Reference, but that didn’t help me with this question.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    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?

    Thread Starter Jonathon N

    (@imagiscapeca)

    (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.)

    Thread Starter Jonathon N

    (@imagiscapeca)

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

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    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;
    }
    Thread Starter Jonathon N

    (@imagiscapeca)

    Simple. Sweet.

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

    Thanks.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    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.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Need Blank or Dummy Function Reference for Add_Filter’ is closed to new replies.