Tag Archives: wordpress

Splash page on wordpress

In a recent work, with wordpress, needed a splash page before anyone enter in the *real* page. In the index.php of the wp root installation, this is what I have to have it working.

if( (strpos($_SERVER['HTTP_REFERER'], 'riadeaveiro.pt') === false) && !$_SERVER['QUERY_STRING']){
 include './splash/splash.php';
 exit();
}

/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require('./wp-blog-header.php');

So, you should replace riadeaveiro.pt for the domain where the wordpress is, and ./splash/splash.php for the path of the slash page that you want to present to your visitor.

WordPress – find and replace

I got some wordpress blogs (20+) running on some servers, and from time to time, i need to make some FIND&REPLACE on my posts…

This is the simple way! Directly on mysql.

UPDATE wp_posts SET post_content = REPLACE (  
post_content,  
'Item to replace here',  
'Replacement text here');

Please note the for security reasons the prefix wp_ is diferent… if you play by the rules you will need to see witch is is… wp-config.php has it.

mysql> UPDATE wpspt_posts SET post_content = REPLACE (
-> post_content,
-> 'static.mycdn.com/banners/',
-> 'static.mycdn.com/bnnrs/');
Query OK, 1477 rows affected (0.42 sec)
Rows matched: 10795 Changed: 1477 Warnings: 0

This is a small hack to ABP – Ad Blocker Plus…
Horray!