Hook to generate a dynamic sitemap with “All in One SEO Pack” Plugin

This is the solution from Peter Baylies (Plugin Author) add_filter( ‘option_aioseop_options’, ‘itdge_sitemap_addl_pages’ ); function itdge_sitemap_addl_pages( $option ) { if ( !empty( $option ) && !empty( $option[‘modules’] ) && !empty( $option[‘modules’][‘aiosp_sitemap_options’]) ) { $my_sitemap_entries = Array( ‘/test1’ => Array( ‘prio’ => ‘0.1’, ‘freq’ => ‘daily’, ‘mod’ => ‘2014-04-01’ ), ‘/test2’ => Array( ‘prio’ => ‘0.3’, ‘freq’ … Read more

get_plugins() doesn’t work after plugins_loaded

Possibly you’re trying to use that code in a non-admin page. The functon get_plugins is only available on admin side and if you ant to use it somewhere else you have to load the file “plugin.php” manually. To solve this error add that check at the beginning of your function: if ( ! function_exists( ‘get_plugins’ … Read more

How can I create a plugin installation link?

Well, looks like I have found the answer. The action should be changed like so: $action = ‘install-plugin’; $slug = ‘akismet’; wp_nonce_url( add_query_arg( array( ‘action’ => $action, ‘plugin’ => $slug ), admin_url( ‘update.php’ ) ), $action.’_’.$slug ); The answer was found in line 275 in the source code: https://core.trac.wordpress.org/browser/tags/3.9.1/src/wp-admin/includes/plugin-install.php

How to include plugin without activation?

WP_PLUGIN_DIR.’/pluginName/’ will give you the absolute path to the directory of the plugin. EDIT After comment Plugins are plugins, theme files are theme files. Lets not confuse the two. You cannot copy a plugin in the theme directory – because stuff does not work like that. After careful editing you can include the plugin as … Read more

Have plugin require two other plugins

check if the plugins are active and display a warning at the top of the page if there not: http://codex.wordpress.org/Function_Reference/is_plugin_active add_action( ‘admin_init’, ‘spp_plugin_has_parents’ ); function spp_plugin_has_parents() { if ( is_admin() && current_user_can( ‘activate_plugins’) && !is_plugin_active( ‘advanced-custom-fields/acf.php’) || !is_plugin_active( ‘paid-memberships-pro/paid-memberships-pro.php’ ) ) { add_action( ‘admin_notices’, ‘spp_plugin_notice’ ); deactivate_plugins( plugin_basename( __FILE__) ); if ( isset( $_GET[‘activate’] ) … Read more

Check if User exists in WordPress Multisite

You can check existing user with “username_exists” WordPress function and insert user using “wp_insert_user” function as below for Network site also: if( username_exists( ‘username’ ) ) { _e( ‘Username already exists’, ‘your-text-domain’ ); } else { _e( ‘Username does not exists.’, ‘your-text-domain’ ); $userdata = array( ‘user_login’ => ‘username’, ‘user_url’ => ‘http://example.com’, ‘user_pass’ => wp_generate_password(), … Read more

WordPress with Git deployment issues

I commit all WordPress because I consider it one big ball of code that pertains to one site, this means updates to core WordPress files, plugins and themes are all part of the commit history. I don’t use sub-modules or any other weird nested revision setups. If you have a complicated structure of including multiple … Read more

Is there a way to make a pure vanila page of just HTML/CSS/JS

I’ve done this in the past by using custom page templates. Basically, there are two ways to create a custom page template. You can create a file in your themes directory and name it page-vanilla-html.php. You can create a file and name it whatever you want (for example vanilla-html.php). You just need to include a … Read more