How to use add_action(“wpcf7_before_send_mail” outside wp loop?

Just simply put your add_action hook in a simple plugin. Activate the plugin and watch it run with the rest of the plugins. If you insist on putting the add_action in the theme’s functions.php then simply define a constant in your point of entry script, like this: define(‘SCRIPTONOMY’, true); Finally run a conditional in the … Read more

Turning WordPress Into full-featured website?

Yes! I’ve used WordPress to create many large sites, that are by no means blogs. Sometimes the structure that WordPress uses, with the custom posts + taxonomies, etc., actually makes things much easier than many PHP frameworks. There seems to be a big discussion in the PHP community as to whether WordPress should be used … Read more

How do i get a specific user metadata using custom metavalue outside of wordpress?

If you have billing_phone as user meta, which is the preferred way, that query would be incorrect. The advantage of utilizing custom user meta and adding a field for billing_phone would allow you to use get_users(). $user = get_users(‘meta_key’ => ‘billing_phone’, ‘meta_value’ => $phone_number, ‘fields’ => ‘ID’); The above would give you an array of … Read more

allow previews outside wordpress folder (Outsourcing WP previews)

The cause of this problem is the wordpress checking for his cookies – and cookies are different for each folder. So the way of fixing can be temporarily save WP cookies too session and then hardcode them after redirect before the WP load. Solved thanks to https://stackoverflow.com/questions/21542795/wordpress-allow-previews-outside-wordpress-folder

logged_in user outside of wordpress loop

this worked with root cookie: <?php define(‘WP_USE_THEMES’, false); if (file_exists(‘../books/wp-blog-header.php’)) { require_once(‘../books/wp-blog-header.php’); } else { echo ‘ERROR: blog header does not exist’; } global $current_user; get_currentuserinfo(); # Either load WordPress : http://codex.wordpress.org/Integrating_WordPress_with_Your_Website # or Manually define your url like… $cookieurl = “mybooksite.com”; define( ‘COOKIEHASH’, md5( $cookieurl ) ); $cookiename = “wordpress_logged_in_” . COOKIEHASH; $sitetitle=”Book Viewer”; … Read more

WordPress Footer Widget Processing

In your sidebar array as an example: register_sidebar(array( ‘id’ => ‘footer’, ‘name’ => ‘Footer’, ‘before_widget’ => ‘<div id=”%1$s” class=”widget col-sm-4 %2$s”>’, ‘after_widget’ => ‘</div>’, ‘before_title’ => ‘<h4 class=”widgettitle”>’, ‘after_title’ => ‘</h4>’, )); Don’t worry about wrapping the sidebar in a row. Let this do it for you. See, the col-sm-4 (or whatever size, with 4) … Read more