Jump to content
codexpower

Wordpress and PHP

Recommended Posts

There's many, many tutorials on writing WP plugins.

 

https://www.google.com/#q=creating+wordpress+plugins

http://codex.wordpress.org/Writing_a_Plugin

 

There's also more than a few books on the topic - this one is not bad for beginners.

 

Check out some of the links, give a few things a try, and ask any questions you may have - good luck and enjoy the trip!

Share this post


Link to post
Share on other sites

 

 

Actually Buddy I visited those WordPress Codex links, but the problem is it not easy for a beginner to learn directly from wordpress codex. If some video exists explaining those things that may help.

 

I was willing to go with lynda.com, but there is no money back. what If I do not find what I am looking for. Your help is appreciated and will be further appreciated.

Edited by codexpower

Share this post


Link to post
Share on other sites

Tons of Basic WordPress video tutorials are there in you tube. For the beginners I think, video tutorials make lasting impacts primarily. Please try it before you go down writing your own themes and plugins. 

Share this post


Link to post
Share on other sites

@Sanjib Sinha

 

I used some videos on you tube, but none are very informative. Can you give me few videos that has intensive focus on hooks in wordpress.

Share this post


Link to post
Share on other sites

Wordpress is an ever changing complicated mess of their own renamed functions.

 

Yes, yes it is...

 

@codexpower - the biggest thing is that WordPress is huge, and asking for tutorials on how to <airquotes>program for it</airquotes> really isn't the way to go. If you've got a specific issue with a theme or plugin you're currently using that you want to fix or improve upon, start by working on just that issue. Basically, give yourself a project and set yourself a goal, then use PHP.net, the WP codex, and the many tutorials on the web to work towards that goal. When you get stuck, then ask a specific question here.

 

We're all more than willing to help, but we need to know what we're helping with, you know?

Share this post


Link to post
Share on other sites

Yes, yes it is...

 

@codexpower - the biggest thing is that WordPress is huge, and asking for tutorials on how to <airquotes>program for it</airquotes> really isn't the way to go. If you've got a specific issue with a theme or plugin you're currently using that you want to fix or improve upon, start by working on just that issue. Basically, give yourself a project and set yourself a goal, then use PHP.net, the WP codex, and the many tutorials on the web to work towards that goal. When you get stuck, then ask a specific question here.

 

We're all more than willing to help, but we need to know what we're helping with, you know?

 

 

Lets say this is a small function - 

 

<?php
 
add_action( 'after_switch_theme', 'after_switch_theme_example' );
 
function after_switch_theme_example() {
    flush_rewrite_rules();
}
 
?>
 
Please help me to under these functions more clearly.
 
In think this is not a function -
add_action( 'after_switch_theme', 'after_switch_theme_example' );
 
The two things in blue are some kind of parameters.

Share this post


Link to post
Share on other sites

Looking the wordpress function up in the wordpress docs might be helpful.

I have learned some PHP in college. i think before jumping into wordpress I must master functions and array. I know basic, Can you recommend some books where functions and arrays are discussed in details at advanced level.

Share this post


Link to post
Share on other sites

First and foremost, add_action() and add_filter() are WordPress hook functions - they're specialized global functions that allow the developer to inject a custom function into the core functionality at specific points. So, in your case, at the point that the WordPress core calls after_switch_themes, it will call the user-defined function after_switch_theme_example(). This, by the way, a simplified explanation...

 

Keep in mind as you're learning: WordPress - from a modern programming point of view - it's really not very well written. The reliance on global variables and functions, and some of the ways in which what classes there are are used is just backwards and old-fashioned. From an end-user point of view, it's great - it allows you to do a lot of things for very little effort. However, it can become rather frustrating quickly as you develop for it. And as far as PHP books and tutorials go, there's a literal ton of them out there but you need to be a little careful because a lot of them are old and PHP has changed a lot in the last several years. If you see a lot of $_REQUEST variables, the keyword global, or any kind of hashing using md5, just assume it's out of date and won't be of much practical help to you. I don't know of any good beginner tutorials or books right off the top of my head, but hopefully someone can kick in with an example or two for you.

Share this post


Link to post
Share on other sites

First and foremost, add_action() and add_filter() are WordPress hook functions - they're specialized global functions that allow the developer to inject a custom function into the core functionality at specific points. So, in your case, at the point that the WordPress core calls after_switch_themes, it will call the user-defined function after_switch_theme_example(). This, by the way, a simplified explanation...

 

Keep in mind as you're learning: WordPress - from a modern programming point of view - it's really not very well written. The reliance on global variables and functions, and some of the ways in which what classes there are are used is just backwards and old-fashioned. From an end-user point of view, it's great - it allows you to do a lot of things for very little effort. However, it can become rather frustrating quickly as you develop for it. And as far as PHP books and tutorials go, there's a literal ton of them out there but you need to be a little careful because a lot of them are old and PHP has changed a lot in the last several years. If you see a lot of $_REQUEST variables, the keyword global, or any kind of hashing using md5, just assume it's out of date and won't be of much practical help to you. I don't know of any good beginner tutorials or books right off the top of my head, but hopefully someone can kick in with an example or two for you.

@maxxd,

 

Thanks Boss that was awesome and very helpful to me.

Share this post


Link to post
Share on other sites

I found a very beautiful tutorials on tuts - 

http://code.tutsplus.com/tutorials/creating-your-own-widgets-using-various-wordpress-apis-introduction--cms-22460

<?php
class TutsPlusText_Widget extends WP_Widget {
     
  // widget constructor
  public function __construct(){
     
  }
    
  public function widget( $args, $instance ) {
    // outputs the content of the widget
  }
    
  public function form( $instance ) {
    // creates the back-end form
  }
    
  // Updating widget replacing old instances with new
  public function update( $new_instance, $old_instance ) {
    // processes widget options on save
  }
   
}

But they have not clarified that where will this go. I mean in which file. I believe it should be themes functions.php. Can some one comment Please?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.