Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I don't want to ask the user to install this and that plugin, I want my theme to be 100% active active without the need to install a plugin like wp-postviews plugin, so how can i do that. I want to include it directly in functions.php file? Thanks in advance.

share|improve this question

2 Answers 2

That was so easy! I just included the plugin folder in my theme Then i included it.

 include(your-theme-path . 'wp-postviews/wp-postviews.php');

That was it!

share|improve this answer

You could include the particular plugin in your theme directory and then fire a function on after_switch_theme:

add_action( 'after_switch_theme', 'fwp_theme_setup' );
function fwp_theme_setup(){ 
    require_once($_SERVER['DOCUMENT_ROOT'].'/wp-admin/includes/plugin.php');
    activate_plugin('your-theme/plugin-dir/plugin.php');
}

You should also take a look at after_setup_theme always runs

share|improve this answer
    
Thanks for taking the time, but it doesn't work, I found a solution though, you can find it in my answer below. –  Rahman Sharif Feb 1 '13 at 22:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.