Jump to content
Sign in to follow this  
wendygordon

trouble modifying functions.php in platform base

Recommended Posts

wendygordon

Every time I try to modify the functions.php file in platform base 1.32 i get a parse error. I have tried to put it in using both the editor in wordpress. and also by editing the file directly and uploading via ftp. I must be doing something wrong. In this case, I have activated a plugin called pixiopoint. In their installation instructions they write: add the following code to your theme <?php if (function_exists('pixopoint_menu')) {pixopoint_menu(2);} ?>. so, I copied and pasted the following line: <?php if (function_exists('pixopoint_menu')) {pixopoint_menu(2);} ?> and i put it at the very very end of a virgin (unaltered, didn't change anything) functions.php file AND I get a parse error. Am i putting it into the wrong place? do i have a syntax error? is there something else I need to do? thanks so much. Wendy

Share this post


Link to post
Share on other sites
Andrew

Syntax looks, good. Are you using php tags correctly? well, what is the error you're seeing? what does it say?

Share this post


Link to post
Share on other sites
cshoffmann

I am trying to replicate the issue on my sandbox site. I can't find the plugin pixiopoint, so would you please provide me a link to the plugin so I may install it.

Share this post


Link to post
Share on other sites
cshoffmann

Adding the line of php code to the functions.php file does not tell it to add the action. functions.php is for using hooks (my understanding) see http://www.pagelines.com/docs/base-child-theme below from http://wordpress.org/extend/plugins/pixopoint-menu/installation/

Activate the plugin through the 'Plugins' menu in WordPress 3a. Either: Add <?php if ( function_exists( 'pixopoint_menu' ) ) {pixopoint_menu();} ?> to your theme wherever you want the menu to appear (usually your header.php file).
If you were to add it to the header.php file, then the only issue I think would be that you would not be able upgrade PlatformPro in the future without having to repeat the code in the header.php file. Better to add_action, remove_action in function.php (base)

Share this post


Link to post
Share on other sites
Simon

Something like this would be the proper way to go about it: Add this to the bottom of your base functions.php: `add_action( 'pagelines_before_main', 'add_my_pixopoint' );` `function add_my_pixopoint() {` `if (function_exists('pixopoint_menu')) {` `pixopoint_menu( 2 );` `}` `}` *NOTE* I have not used and php open/close tags, as the php open tag is at the top of the file, when you added your code before you were adding a second open tag, thats why you got your parse error.

Share this post


Link to post
Share on other sites
wendygordon

Simon - thanks so much. I AM STUCK ON one thing though. you have typed the name of the function as: add_my_pixiopoint ... how did you know or decide what to call it? according to the WP codex: "The name of the function that you want to be executed following the event specified by hook_name. This can be a standard php function, a function present in the WordPress core, or a function defined by you in the plugin file" do i need to open the plugin's php file to find out what the author named the function? do I just make up a name that I want to call it? so if i am understanding this correctly there are really 3 parts to the "simply drop this code into your theme" instructions that so many plug-ins tell you? part 1. add action - is this what you call defining the hook? ie. tell it where in the platformpro structure to put it? and put in the function name? part 2.call the function part 3. simply drop the code into my theme (ie, the cut and paste that is provided by the plug in author) Also. I now understand that i dont need to type <?php because it is already at the top of the functions.php file. thanks. so much. W

Share this post


Link to post
Share on other sites
Simon

I'll try and quickly break it down... `add_action('pagelines_before_main', 'add_my_pixopoint');` This says when you reach the action point `pagelines_before_main` execute user function `add_my_pixopoint` Then we have the user function, we could have called anything we want, as long as in the action its the same see? `function aunty_mables_kitchen_table() {` `if (function_exists('pixopoint_menu')) {` `pixopoint_menu( 2 );` `}` `}` // end of user function

Share this post


Link to post
Share on other sites
wendygordon

ok. i think I get it.. where did YOU get add_my_pixopoint? you made it up right? so when i download a plugin called groovyplugin ... this is what i would do? - add all three of the following lines to the bottom of the functions.php file? and the user function name is whatever I want to make it - in this case my_made_upgroovy? add_action('pagelines_before_main', 'add_my_made_upgroovy'); function add_my_made_up_groovy() { // this next part is the part that the plug in directions say to "drop into my code" // if (function_exists('groovy_plug')) { groovy_plug( 2 ); } } sorry to be thick. it is a steep learning curve!

Share this post


Link to post
Share on other sites
Simon

pretty much yes... add_action('pagelines_before_main', 'unique_function_name'); function unique_function_name() { // <-- open brace // begin custom code as directed by plugin instructions. echo 'hello world!'; // end of code } // <-- closing brace

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×