The Hackadelic Sliding Notes Plugin– what a filter change can do

by admin on 06/06/10 at 3:05 pm

One of the best plu­g­ins which are out there belongs to a great owner known as The Hack­adelic and its his slid­ing Notes plu­gin(http://hackadelic.com/solutions/wordpress/sliding-notes).So, read­ing his post and just going to his web site is a pure enjoy­ment to every code/developer.

In short, the “Slid­ing Notes” plu­gin enables a post writer to but this kind of open/close “ajaxed” but­ton with info

here is an exam­ple of how it’s ren­dered (click on the link):

“click»

Ok.so we under­stand how to use his plu­gin , and the num­ber of com­ments in that post reflects the bug usage of oth­ers in that plugin.

when i started using his plu­gin, I needed to add dynamic data to the note.so, right from the begin­ing i under­stood i had to use using his plu­gin but  in a php style and not in a post writ­ing. obeis­llyy the way to use any short­code in word­press code is by call­ing the “do_shortcode” function.

So, here is an sim­ple exam­ple of using the do_shortcode :

<?php
echo do_shortcode("slider title=\"click me again\"]nore data...[/slider"); //remeber to put '[' and ']' at the begining and the end.
?>

So, lets assume i am edit­ing the single.php page and i want to add the dynamic data as a sli­de­note in the post.so what do we do?

 

Well, its quite a sim­ple answer:just look for the call of

 

 <?php the_content(); ?>

And then add the

<?php echo do_shortcode(put here the slideing shortcode) ?>

and that it.

So, up till here , noth­ing is quite new.you can read it on sev­eral of the arti­cle com­ments and get ti working.What i wanted to do was to add the short­code and make the slider appear before the con­tent of the post is ren­dered, so the first thing i tryed was putting the short­code before the “the_content” call.

how naive i was, It didnt worked.

So, i per­son­lly asked Hack­adelic how to do it and he throw me a hint that there are filters/hooks involved that don’t allow this kind of behavoir.

mmmm.so we need to dis­able that hook right?

 

i went straight to his code and i found this block of code in the hackadelic-sliding-notes/hackadelic-sliders.php:

function initPublic() {
        add_action('wp_print_scripts', array(&$this, 'enqueueScripts'));
        add_action('wp_head', array(&$this, 'embedPrologue'), 99);
        add_action('wp_footer', array(&$this, 'embedEpliogue'));
        add_filter('the_content', array(&$this, 'preProcessContent'), 10);
//remark this line to enable rendering before "the_content" call
        add_shortcode('slider', array(&$this, 'doShortcode'));
        add_filter('the_content', array(&$this, 'postProcessContent'), 12);
        // DO NOT preProcessContent with widget_text !
        add_filter('widget_text', array(&$this, 'postProcessContent'), 12);
    }

So, using the hint, i knew i was on the right track(include the fact that theere are none usage of add_filter call in any of the plu­gin files).Than i saw the 4th line (i high­t­light t) and i remarked it.

the result, is that we can put the sli­de­not short­code before the “the_content” call and it ren­dered and working.

Hope it was use­full to as it was to me.And Hackadelic!bravo on your plugins.

 

VN:F [1.9.3_1094]
Rat­ing: 0 (from 0 votes)

Pop­u­lar­ity: 13% [?]

Hello And welome to the office sur­vivor blog!Pow­ered by Hack­adelic Slid­ing Notes 1.6.4
  • Share/Bookmark

Related Posts

4 Responses to “The Hackadelic Sliding Notes Plugin– what a filter change can do”

  1. […] The Hack­adelic Slid­ing Notes Plu­gin– what a fil­ter change can do | The Office Survivor […]

  2. pell grant

    Jun 7th, 2010

    Ter­rific work! This is the type of infor­ma­tion that should be shared around the web. Shame on the search engines for not posi­tion­ing this post higher!

    VA:F [1.9.3_1094]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.3_1094]
    Rating: 0 (from 0 votes)
  3. bazel

    Aug 24th, 2010

    this can be used only on sin­gle, not on cat­e­gory tem­plate. when in cat­e­gory it gets the con­tent form the first post an all others

    VA:F [1.9.3_1094]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.3_1094]
    Rating: 0 (from 0 votes)
    • yoavadler

      Aug 26th, 2010

      You are right.

      I intend to post an arti­cle about the slid­ing alternativs.i will take in con­si­daratin cat­e­gory templates.

      VN:F [1.9.3_1094]
      Rating: 0.0/5 (0 votes cast)
      VN:F [1.9.3_1094]
      Rating: 0 (from 0 votes)

Leave a Reply


Please leave these two fields as-is:

Protected by Invisible Defender. Showed 403 to 1,127 bad guys.


PHVsPjxsaT48c3Ryb25nPndvb19hZHNfcm90YXRlPC9zdHJvbmc+IC0gdHJ1ZTwvbGk+PGxpPjxzdHJvbmc+d29vX2FkXzMwMF9hZHNlbnNlPC9zdHJvbmc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