Jump to content


Photo
Hooker

Hooker plugin - How to use specific features.



Best Answer James B , 21 March 2013 - 03:16 AM

Did the above work for you?

 

I think this error was related to the admin bar being disabled, Simon is pushing a fix for this.

 

Please see - http://www.pagelines...rns-site-blank/

Go to the full post


  • Please log in to reply
14 replies to this topic

#1 espartaco

espartaco

    Newbie

  • Members
  • 8 posts
  • Country: Country Flag

Posted 20 March 2013 - 12:51 PM

Hi all,

 

I've just bought the hooker plugin because I am interesting into adding custom js to some of my post/pages.

 

I have seen here [http://www.pagelines...ugins/hooker/#] the next features:

 

  1. Assign hooks to specific pages/posts easily.
  2. Toggle hooks on/off.

The question is... how? Because when I am creating a new Hook (using this plugin), I can select many locations but I can not see my actual pages or post...

 

Any advice?

 

Thanks.

Attached Files



#2 greenfly

greenfly

    Advocate

  • Members

  • 3268 posts
  • LocationManchester, England
  • Framework Version:latest
  • Country: Country Flag

Posted 20 March 2013 - 01:15 PM

Hi Espartaco 

 

Install the free Action-Map plugin to see where WordPress and PageLines actions are included in the templates live on the page. http://www.pagelines...nes-action-map/

 

Once activated, when you are logged in and view your site you will see an ‘action map on or off’ button on the admin bar. http://d.pr/i/weQ


Toggle on or off to see the available hooks.



#3 espartaco

espartaco

    Newbie

  • Members
  • 8 posts
  • Country: Country Flag

Posted 20 March 2013 - 02:08 PM

Hi Martin,

 

First of all thank you for your quick response.

Playing with the plugin(creating one hook and delete it) I think I broke something (quite common situation  :D ). Right now if the plugin is activated I am getting this error when I try to load my web:

 

Fatal error: Call to a member function add_menu() on a non-object in /..../..../wp-content/plugins/hooker/hooker.php on line 44

 

How can I solve this problem?? After solve it I'll try your notes.

 

Other question, I have been trying other of your plugins (Simply Custom) which is more intuitive for me, but when I try to inject a simple alert('Hello world'); it doesn't work, nothing happens. Why?? Any idea?

 

Thanks in advance,



#4 anlinares

anlinares

    Super Member

  • Members
  • 229 posts
  • Country: Country Flag

Posted 20 March 2013 - 07:05 PM

I just installed the Hooker plugin and am getting the same Fatal Error



#5 anlinares

anlinares

    Super Member

  • Members
  • 229 posts
  • Country: Country Flag

Posted 20 March 2013 - 07:10 PM

Just found this on another thread:

 

edit hooker.php line 42 to read: if ( current_user_can('edit_theme_options') && is_object( $wp_admin_bar ) ) {



#6 James B

James B

    Advocate

  • Members

  • 5126 posts
  • LocationSurrey - UK
  • Country: Country Flag

Posted 21 March 2013 - 03:16 AM   Best Answer

Did the above work for you?

 

I think this error was related to the admin bar being disabled, Simon is pushing a fix for this.

 

Please see - http://www.pagelines...rns-site-blank/



#7 espartaco

espartaco

    Newbie

  • Members
  • 8 posts
  • Country: Country Flag

Posted 21 March 2013 - 08:35 AM

Thanks James!

 

Simon patch solve the problem. With the 1.3 version is working. 

 

Anyway, I'll still interested in the "simply plugin" custom plugin. 

 

I have attached one screenshot which represent the edit menu of one of my web's page.

 

Both custom code (HTML and JS) are not working... he question is... why??

 

What am I missing?

 

Thanks in advance.

Attached Files



#8 Danny

Danny

    Is Awesome!

  • Moderators
  • 17015 posts
  • LocationManchester, UK
  • Country: Country Flag

Posted 21 March 2013 - 08:52 AM

Hi,

 

The Simply Custom plugin is a third party store product. Therefore, you will need to contact the developer for support.

 

http://highergrounds...ly-custom-demo/



#9 espartaco

espartaco

    Newbie

  • Members
  • 8 posts
  • Country: Country Flag

Posted 21 March 2013 - 09:14 AM

Thanks Danny, in that case I am going to make focus on the Hooks solution (Simply plugin looks like abandoned).

 

The only thing that I need to find out is how can I create hooks for specific pages? Any link to some documentation or example?

 

I know with the "Action-map" plugin allows me all the hooks available, and with the Hookers plugin I can create hookers, but I don't know how  I can associate to one concrete page.

 

If you have any advise, are more than welcome :) .

 

Thanks!.



#10 Danny

Danny

    Is Awesome!

  • Moderators
  • 17015 posts
  • LocationManchester, UK
  • Country: Country Flag

Posted 21 March 2013 - 09:20 AM

In order for your hooks to work on specific pages/posts you will need to use the following.

 

http://codex.wordpre...ference/is_page

http://codex.wordpre...rence/is_single
http://codex.wordpre...nce/is_category



#11 espartaco

espartaco

    Newbie

  • Members
  • 8 posts
  • Country: Country Flag

Posted 21 March 2013 - 09:26 AM

Thanks again,

 

I'll take a look into everything. This concept is new for me, I've been trying to avoid do something with php, but I think is worth learn the basic.

 

I am full experience J2EE (GWT) developer and in that way I can inject my modules with a RestFul API into the PageLines' CMS in safe way.

 

Regards.



#12 espartaco

espartaco

    Newbie

  • Members
  • 8 posts
  • Country: Country Flag

Posted 21 March 2013 - 12:36 PM

Hi again,

 

quick question, how can I inject JS? I have attached one picture.

 

The plugin seems to work but instead of executing the JS I see the "alert('Hello world');" in the web!

 

Also if I put this code inside <script> tags it doesn't work as well (also it stop other pluins...)

 

Thanks.

Attached Files



#13 espartaco

espartaco

    Newbie

  • Members
  • 8 posts
  • Country: Country Flag

Posted 22 March 2013 - 08:15 AM

 
<style>
	#bbpress-forums{
  		color:yellow !important;
		display : none;
	}
</style>

<script>
	alert("test");
	$(document).ready(function() {
            alert("test2");
 	});

	//jQuery(document).ready(function($) {
	//	alert("test 3);
	//});
</script> 

 

Ok I think I have a couple of examples working. The only problem is I don't know how can I use jQuery after the document is loaded (the first alert test works).

 

This code works if I introduced it in the header oft he page (via PageLines > Site Options > Custom Code ) but inside a hook no chance.

 

Any advise?

 

Thanks.



#14 espartaco

espartaco

    Newbie

  • Members
  • 8 posts
  • Country: Country Flag

Posted 22 March 2013 - 08:22 AM

Never mind, solve it!

 

Thanks anyway.



#15 Danny

Danny

    Is Awesome!

  • Moderators
  • 17015 posts
  • LocationManchester, UK
  • Country: Country Flag

Posted 22 March 2013 - 09:01 AM

Hi,

 

Would you mind sharing so other users who may have a similar issue, can use this as a resource.