Love2c0de Posted October 9, 2013 Share Posted October 9, 2013 Good evening all, Is it possible to use a procedural PHP script in Wordpress as normal? Kind regards, L2c. Quote Link to comment Share on other sites More sharing options...
.josh Posted October 9, 2013 Share Posted October 9, 2013 In general, you can write procedural code alongside oo code, yes. class foo { public function doSomething() { echo 'something'; } } function doSomething() { echo 'something'; } $f = new foo(); $f->doSomething(); doSomething(); Do you have a more specific question? Quote Link to comment Share on other sites More sharing options...
Love2c0de Posted October 9, 2013 Author Share Posted October 9, 2013 (edited) Evening, Well I've been asked to write a function for a website and it's for a Wordpress website. When I looked at some of the Wordpress PHP code it looks really complicated. Not so much the OO PHP as I'm familiar with the syntax and look of OO PHP but it seems to have it's own 'type' of PHP code (or the plugins do). Not sure if I can just write a procedural script in a Wordpress website the same as you would for a handcoded website for example or do you have to accommodate any of the Wordpress code/files? Do you have to include any files? Do you have to create the PHP file in a certain directory? Is accessing and returning data from a Wordpress database the same concept as it is for a normal hand coded website? I've only ever handcoded and never used Wordpress or similar CMS systems so it's all new to me. Thanks for the reply. Kind regards, L2c. Edited October 9, 2013 by Love2c0de Quote Link to comment Share on other sites More sharing options...
KevinM1 Posted October 9, 2013 Share Posted October 9, 2013 What are you trying to do specifically? Quote Link to comment Share on other sites More sharing options...
Love2c0de Posted October 10, 2013 Author Share Posted October 10, 2013 (edited) Evening Kevin, I'm waiting on the brief but a general outline is this: They want a drop-down with a list of cities in the UK. This will populate 10 boxes on the page with prices. Each city will have different prices to compensate added costs so it needs to be dynamic. My initial intention is to store the cities and prices in a database using 1 table. Setup could be: id city price1ft price 2ft price3ft etc etc 1 Manchester 26.99 45.99 69.99 etc etc 2 Edinburgh 39.99 55.99 79.99 etc etc It then needs to be further dynamic by adding labour costs depending on the amount of items in square feet. I believe once I have the data from the database I can then use JavaScript to achieve this. When they select an option from the select, I need to query the database for the correct prices and do the above. Thinking of using Ajax but I'm not sure what the client specifically requires at this moment in time so just waiting on an email. And that's pretty much the gist of the idea. Kind regards, L2c. Edited October 10, 2013 by Love2c0de Quote Link to comment Share on other sites More sharing options...
trq Posted October 10, 2013 Share Posted October 10, 2013 Wordpress is just PHP, you could do this as a Wordpress specific plugin on a Wordpress controlled page, or just as a standalone script. Quote Link to comment Share on other sites More sharing options...
Love2c0de Posted October 10, 2013 Author Share Posted October 10, 2013 (edited) Good morning, So safe to say I can just write my script as I would for one of my own sites? Also, what kind of price would you charge someone if they came to you and asked for the same? I've got no way to benchmark prices as this is the first time I've had someone ask me to do a script for them. Regards, L2c. Edited October 10, 2013 by Love2c0de Quote Link to comment Share on other sites More sharing options...
trq Posted October 10, 2013 Share Posted October 10, 2013 What is your time worth? Quote Link to comment Share on other sites More sharing options...
Love2c0de Posted October 10, 2013 Author Share Posted October 10, 2013 I'm thinking it could take around 2-3 hours to write the script and set the database up. Then I need to implement it into the Wordpress website and allow some time for any bugs which may arise. Say 4 hours to complete the whole process. Pricing by the hour, I would probably charge around £50 which works out at just over £12 an hour. That's $84.46 Aussie dollars and $79.70 US dollars. Does that seem expensive for what's required? Regards, L2c. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.