Jump to content


Photo

Where to put PHP code?


  • Please log in to reply
8 replies to this topic

#1 tramullas

tramullas

    Newbie

  • Members
  • 5 posts

Posted 09 April 2012 - 05:55 PM

Dear friends: I need to include some PHP code on the home page. It must go before the Wordpress loop. Can you explain in what file should I include? I can not find the corresponding template file. Thanks, Jes??s

#2 catrina

catrina

    Advocate

  • Members
  • 12345 posts
  • LocationCalifornia
  • Country: Country Flag

Posted 10 April 2012 - 03:36 AM

What is the PHP code supposed to achieve? (It's not advisable to edit any of the core files in the theme)

#3 tramullas

tramullas

    Newbie

  • Members
  • 5 posts

Posted 10 April 2012 - 09:20 AM

I need to control a slider genereted by Power Slider plugin. The code is 1, 'limit' => 10, 'width' => 600, 'height' => 300, 'style' => 'white', // 'white', 'none' 'animation' => 'fade', // 'fade', 'horizontal', 'vertical' 'speed' => 600, 'delay' => 4000 ) ); ?> I try it on the base theme functions file, but it crashes...

#4 Danny

Danny

    Is Awesome!

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

Posted 10 April 2012 - 09:54 AM

Hi,

What do you when you mean "but it crashes" ?

You would most likely have to add it to the child themes or PageLines customisation plug-in function.php file. You will need to probably add it as a hook, at off like this:

 //add_action('pagelines_before_postloop', 'power_slider');
		function power_slider(){?>
	
	Code goes here!

You will also need to use the function is_home, click here for more information.

http://codex.wordpre...ference/is_home

I would also recommend contacting the author of the plug-in too.

#5 tramullas

tramullas

    Newbie

  • Members
  • 5 posts

Posted 10 April 2012 - 04:54 PM

Dear Danny: When I try to do that, WP says internal server error 500, "...wp-admin/plugin-editor.php?file=pagelines-customize/functions.php&a=te&scrollto=364"

#6 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 10 April 2012 - 05:24 PM

Please post the code you are trying to use: http://paste.pagelines.com

#7 tramullas

tramullas

    Newbie

  • Members
  • 5 posts

Posted 12 April 2012 - 11:52 AM

Posted on http://paste.pagelines.com/4p

#8 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 12 April 2012 - 12:34 PM

http://paste.pagelines.com/53

#9 tramullas

tramullas

    Newbie

  • Members
  • 5 posts

Posted 12 April 2012 - 04:25 PM

It works fine, many thanks...