Articles of wp blog header.php

Using plugin functionality in external php script not working

I am encountering a strange problem which I couldn’t solve so far. I’m calling a .php script via cronjob (Debian/GNU Linux). To use wordpress functionailty I added: define(‘WP_USE_THEMES’, false); require( ‘/full/path/to/wp-blog-header.php’ ); Now database queries and default wordpress functionality all works fine, but I also call some functions provided by a plugin (namely advanced custom […]

Limiting conditional comment to home only in header.php

I’ve discovered a solution to an IE problem with a conditional comment. I only need it on the home page because I’ve isolated there with a class on only one image. Unfortunately, the comment causes me some problems on other pages so I need to limit the comment (and script) to function ONLY on the […]

there's a way to include a minimal WP for check only the current user, its roles (caps?) and then release/free it?

I need to count how many times a file in a particular sub-directory is downloaded and track who downloaded it. I’m using a Php file to do it, it isn’t a WP file but I need to include WP to get the current user (if authenticated) and its roles (and maybe caps). Looking at Integrating […]

Force pdf download not working when include blog-header.php

I have this code which works in a file called downloads/download.php: <?php header(‘Content-type: application/octet-stream’); header(‘Content-Disposition: attachment; filename=”file.pdf”‘); readfile(‘file.pdf’); ?> It correctly prompts to download file.pdf. I need to track downloads so I want to make use of various WP functions. To bring the page inside WP I added blog-header.php like so: <?php define(‘WP_USE_THEMES’, false); require(‘../wp-blog-header.php’); […]

Using wordpress and codeigniter in one website

Is it possible to use WordPress as the CMS but all of contents will be displayed using CodeIgniter? What I want to know also if I can use the WordPress functions by simply including this wp-blog-header.php in the CodeIgniter. Do you guys think this idea will work? Probably one of the function I really need […]

Creating a Dynamic Path to wp-blog-header.php

Created a class in an external script which is dependent on the WordPress environment. Since it’s a class I intend to use on various projects, I decided to dynamically create a path to wp-blog-header.php and here’s what I came up with. It currently works for me, but I need to ensure that its foolproof. $docRoot […]

What is the correct way to use WordPress functions outside WordPress files?

I read about 2 methods for initializing WordPress function outside of WordPress files so We can use these functions on any page or website outside the WordPress blog. Which one of these 2 methods is the correct one? What are the use cases for each method if both are correct? What is the deference between […]